blob: 33524dbf53a9cdc7bcf71913204894e29ed84608 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
2 * libjingle
3 * Copyright 2004 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef TALK_MEDIA_WEBRTCVOICEENGINE_H_
29#define TALK_MEDIA_WEBRTCVOICEENGINE_H_
30
31#include <map>
32#include <set>
33#include <string>
34#include <vector>
35
henrike@webrtc.org28e20752013-07-10 00:45:36 +000036#include "talk/media/base/rtputils.h"
37#include "talk/media/webrtc/webrtccommon.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000038#include "talk/media/webrtc/webrtcvoe.h"
39#include "talk/session/media/channel.h"
solenberg566ef242015-11-06 15:34:49 -080040#include "webrtc/audio_state.h"
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000041#include "webrtc/base/buffer.h"
42#include "webrtc/base/byteorder.h"
43#include "webrtc/base/logging.h"
44#include "webrtc/base/scoped_ptr.h"
45#include "webrtc/base/stream.h"
Fredrik Solenberg4b60c732015-05-07 14:07:48 +020046#include "webrtc/base/thread_checker.h"
47#include "webrtc/call.h"
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000048#include "webrtc/common.h"
Henrik Lundin64dad832015-05-11 12:44:23 +020049#include "webrtc/config.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000050
henrike@webrtc.org28e20752013-07-10 00:45:36 +000051namespace cricket {
52
henrike@webrtc.org28e20752013-07-10 00:45:36 +000053class AudioDeviceModule;
henrike@webrtc.org1e09a712013-07-26 19:17:59 +000054class AudioRenderer;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000055class VoETraceWrapper;
56class VoEWrapper;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000057class WebRtcVoiceMediaChannel;
58
59// WebRtcVoiceEngine is a class to be used with CompositeMediaEngine.
60// It uses the WebRtc VoiceEngine library for audio handling.
solenberg566ef242015-11-06 15:34:49 -080061class WebRtcVoiceEngine final : public webrtc::TraceCallback {
Jelena Marusicc28a8962015-05-29 15:05:44 +020062 friend class WebRtcVoiceMediaChannel;
63
henrike@webrtc.org28e20752013-07-10 00:45:36 +000064 public:
65 WebRtcVoiceEngine();
66 // Dependency injection for testing.
Fredrik Solenbergccb49e72015-05-19 11:37:56 +020067 WebRtcVoiceEngine(VoEWrapper* voe_wrapper, VoETraceWrapper* tracing);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000068 ~WebRtcVoiceEngine();
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000069 bool Init(rtc::Thread* worker_thread);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000070 void Terminate();
71
solenberg566ef242015-11-06 15:34:49 -080072 rtc::scoped_refptr<webrtc::AudioState> GetAudioState() const;
Fredrik Solenberg709ed672015-09-15 12:26:33 +020073 VoiceMediaChannel* CreateChannel(webrtc::Call* call,
74 const AudioOptions& options);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000075
mallinath@webrtc.orga27be8e2013-09-27 23:04:10 +000076 AudioOptions GetOptions() const { return options_; }
77 bool SetOptions(const AudioOptions& options);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000078 bool SetDevices(const Device* in_device, const Device* out_device);
79 bool GetOutputVolume(int* level);
80 bool SetOutputVolume(int level);
81 int GetInputLevel();
henrike@webrtc.org28e20752013-07-10 00:45:36 +000082
83 const std::vector<AudioCodec>& codecs();
84 bool FindCodec(const AudioCodec& codec);
85 bool FindWebRtcCodec(const AudioCodec& codec, webrtc::CodecInst* gcodec);
86
87 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;
88
89 void SetLogging(int min_sev, const char* filter);
90
henrike@webrtc.org28e20752013-07-10 00:45:36 +000091 // For tracking WebRtc channels. Needed because we have to pause them
92 // all when switching devices.
93 // May only be called by WebRtcVoiceMediaChannel.
solenberg63b34542015-09-29 06:06:31 -070094 void RegisterChannel(WebRtcVoiceMediaChannel* channel);
95 void UnregisterChannel(WebRtcVoiceMediaChannel* channel);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000096
henrike@webrtc.org28e20752013-07-10 00:45:36 +000097 // Called by WebRtcVoiceMediaChannel to set a gain offset from
98 // the default AGC target level.
99 bool AdjustAgcLevel(int delta);
100
101 VoEWrapper* voe() { return voe_wrapper_.get(); }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000102 int GetLastEngineError();
103
Fredrik Solenbergccb49e72015-05-19 11:37:56 +0200104 // Set the external ADM. This can only be called before Init.
105 bool SetAudioDeviceModule(webrtc::AudioDeviceModule* adm);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000106
wu@webrtc.orga9890802013-12-13 00:21:03 +0000107 // Starts AEC dump using existing file.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000108 bool StartAecDump(rtc::PlatformFile file);
wu@webrtc.orga9890802013-12-13 00:21:03 +0000109
ivoc797ef122015-10-22 03:25:41 -0700110 // Stops AEC dump.
111 void StopAecDump();
112
ivoc112a3d82015-10-16 02:22:18 -0700113 // Starts recording an RtcEventLog using an existing file until 10 minutes
114 // pass or the StopRtcEventLog function is called.
115 bool StartRtcEventLog(rtc::PlatformFile file);
116
117 // Stops recording the RtcEventLog.
118 void StopRtcEventLog();
119
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000120 private:
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000121 void Construct();
122 void ConstructCodecs();
henrik.lundin@webrtc.org8038d422014-11-11 08:38:24 +0000123 bool GetVoeCodec(int index, webrtc::CodecInst* codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000124 bool InitInternal();
125 void SetTraceFilter(int filter);
126 void SetTraceOptions(const std::string& options);
solenberg63b34542015-09-29 06:06:31 -0700127 // Every option that is "set" will be applied. Every option not "set" will be
128 // ignored. This allows us to selectively turn on and off different options
129 // easily at any time.
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000130 bool ApplyOptions(const AudioOptions& options);
xians@webrtc.org3cefbc92014-10-10 09:42:53 +0000131
132 // webrtc::TraceCallback:
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000133 void Print(webrtc::TraceLevel level, const char* trace, int length) override;
xians@webrtc.org3cefbc92014-10-10 09:42:53 +0000134
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000135 // Given the device type, name, and id, find device id. Return true and
136 // set the output parameter rtc_id if successful.
137 bool FindWebRtcAudioDeviceId(
138 bool is_input, const std::string& dev_name, int dev_id, int* rtc_id);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000139
140 void StartAecDump(const std::string& filename);
solenberg0a617e22015-10-20 15:49:38 -0700141 int CreateVoEChannel();
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000142
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000143 static const int kDefaultLogSeverity = rtc::LS_WARNING;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000144
solenberg566ef242015-11-06 15:34:49 -0800145 rtc::ThreadChecker signal_thread_checker_;
146 rtc::ThreadChecker worker_thread_checker_;
147
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000148 // The primary instance of WebRtc VoiceEngine.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000149 rtc::scoped_ptr<VoEWrapper> voe_wrapper_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000150 rtc::scoped_ptr<VoETraceWrapper> tracing_;
solenberg566ef242015-11-06 15:34:49 -0800151 rtc::scoped_refptr<webrtc::AudioState> audio_state_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000152 // The external audio device manager
solenberg566ef242015-11-06 15:34:49 -0800153 webrtc::AudioDeviceModule* adm_ = nullptr;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000154 int log_filter_;
155 std::string log_options_;
solenberg566ef242015-11-06 15:34:49 -0800156 bool is_dumping_aec_ = false;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000157 std::vector<AudioCodec> codecs_;
158 std::vector<RtpHeaderExtension> rtp_header_extensions_;
solenberg63b34542015-09-29 06:06:31 -0700159 std::vector<WebRtcVoiceMediaChannel*> channels_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000160 webrtc::AgcConfig default_agc_config_;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000161
162 webrtc::Config voe_config_;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000163
solenberg566ef242015-11-06 15:34:49 -0800164 bool initialized_ = false;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000165 AudioOptions options_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000166
Henrik Lundin441f6342015-06-09 16:03:13 +0200167 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns
Bjorn Volckerbf395c12015-03-25 22:45:56 +0100168 // values, and apply them in case they are missing in the audio options. We
169 // need to do this because SetExtraOptions() will revert to defaults for
170 // options which are not provided.
Karl Wibergbe579832015-11-10 22:34:18 +0100171 rtc::Optional<bool> extended_filter_aec_;
172 rtc::Optional<bool> delay_agnostic_aec_;
173 rtc::Optional<bool> experimental_ns_;
solenbergc96df772015-10-21 13:01:53 -0700174
175 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcVoiceEngine);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000176};
177
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000178// WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses
179// WebRtc Voice Engine.
solenberg566ef242015-11-06 15:34:49 -0800180class WebRtcVoiceMediaChannel final : public VoiceMediaChannel,
181 public webrtc::Transport {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000182 public:
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200183 WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine,
184 const AudioOptions& options,
185 webrtc::Call* call);
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200186 ~WebRtcVoiceMediaChannel() override;
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200187
solenberg66f43392015-09-09 01:36:22 -0700188 const AudioOptions& options() const { return options_; }
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200189
Peter Thatcherc2ee2c82015-08-07 16:05:34 -0700190 bool SetSendParameters(const AudioSendParameters& params) override;
191 bool SetRecvParameters(const AudioRecvParameters& params) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200192 bool SetPlayout(bool playout) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000193 bool PausePlayout();
194 bool ResumePlayout();
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200195 bool SetSend(SendFlags send) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000196 bool PauseSend();
197 bool ResumeSend();
Peter Boström0c4e06b2015-10-07 12:23:21 +0200198 bool SetAudioSend(uint32_t ssrc,
199 bool enable,
200 const AudioOptions* options,
solenberg1dd98f32015-09-10 01:57:14 -0700201 AudioRenderer* renderer) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200202 bool AddSendStream(const StreamParams& sp) override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200203 bool RemoveSendStream(uint32_t ssrc) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200204 bool AddRecvStream(const StreamParams& sp) override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200205 bool RemoveRecvStream(uint32_t ssrc) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200206 bool GetActiveStreams(AudioInfo::StreamList* actives) override;
207 int GetOutputLevel() override;
208 int GetTimeSinceLastTyping() override;
209 void SetTypingDetectionParameters(int time_window,
210 int cost_per_typing,
211 int reporting_threshold,
212 int penalty_decay,
213 int type_event_delay) override;
solenberg4bac9c52015-10-09 02:32:53 -0700214 bool SetOutputVolume(uint32_t ssrc, double volume) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000215
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200216 bool CanInsertDtmf() override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200217 bool InsertDtmf(uint32_t ssrc, int event, int duration, int flags) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000218
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200219 void OnPacketReceived(rtc::Buffer* packet,
220 const rtc::PacketTime& packet_time) override;
221 void OnRtcpReceived(rtc::Buffer* packet,
222 const rtc::PacketTime& packet_time) override;
223 void OnReadyToSend(bool ready) override {}
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200224 bool GetStats(VoiceMediaInfo* info) override;
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200225
226 // implements Transport interface
stefan1d8a5062015-10-02 03:39:33 -0700227 bool SendRtp(const uint8_t* data,
228 size_t len,
229 const webrtc::PacketOptions& options) override {
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200230 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
231 kMaxRtpPacketLen);
stefanc1aeaf02015-10-15 07:26:07 -0700232 rtc::PacketOptions rtc_options;
233 rtc_options.packet_id = options.packet_id;
234 return VoiceMediaChannel::SendPacket(&packet, rtc_options);
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200235 }
236
pbos2d566682015-09-28 09:59:31 -0700237 bool SendRtcp(const uint8_t* data, size_t len) override {
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200238 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
239 kMaxRtpPacketLen);
stefanc1aeaf02015-10-15 07:26:07 -0700240 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions());
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200241 }
242
Peter Boström0c4e06b2015-10-07 12:23:21 +0200243 int GetReceiveChannelId(uint32_t ssrc) const;
244 int GetSendChannelId(uint32_t ssrc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000245
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200246 private:
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200247 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
248 bool SetSendRtpHeaderExtensions(
249 const std::vector<RtpHeaderExtension>& extensions);
250 bool SetOptions(const AudioOptions& options);
251 bool SetMaxSendBandwidth(int bps);
252 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
253 bool SetRecvRtpHeaderExtensions(
254 const std::vector<RtpHeaderExtension>& extensions);
Peter Boström0c4e06b2015-10-07 12:23:21 +0200255 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer);
256 bool MuteStream(uint32_t ssrc, bool mute);
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200257
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200258 WebRtcVoiceEngine* engine() { return engine_; }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000259 int GetLastEngineError() { return engine()->GetLastEngineError(); }
260 int GetOutputLevel(int channel);
261 bool GetRedSendCodec(const AudioCodec& red_codec,
262 const std::vector<AudioCodec>& all_codecs,
263 webrtc::CodecInst* send_codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000264 bool SetPlayout(int channel, bool playout);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000265
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000266 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool,
267 unsigned char);
henrike@webrtc.org1e09a712013-07-26 19:17:59 +0000268
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000269 void SetNack(int channel, bool nack_enabled);
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000270 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000271 bool ChangePlayout(bool playout);
272 bool ChangeSend(SendFlags send);
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000273 bool ChangeSend(int channel, SendFlags send);
wu@webrtc.org78187522013-10-07 23:32:02 +0000274 bool ConfigureRecvChannel(int channel);
solenberg0a617e22015-10-20 15:49:38 -0700275 int CreateVoEChannel();
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000276 bool DeleteChannel(int channel);
solenberg1ac56142015-10-13 03:58:19 -0700277 bool IsDefaultRecvStream(uint32_t ssrc) {
278 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
279 }
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000280 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs);
minyue@webrtc.org26236952014-10-29 02:27:08 +0000281 bool SetSendBitrateInternal(int bps);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000282
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000283 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id,
284 const RtpHeaderExtension* extension);
Fredrik Solenberg709ed672015-09-15 12:26:33 +0200285 void RecreateAudioReceiveStreams();
Peter Boström0c4e06b2015-10-07 12:23:21 +0200286 void AddAudioReceiveStream(uint32_t ssrc);
287 void RemoveAudioReceiveStream(uint32_t ssrc);
Fredrik Solenbergaf9fb212015-08-26 10:45:53 +0200288 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs);
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200289
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000290 bool SetChannelRecvRtpHeaderExtensions(
291 int channel_id,
292 const std::vector<RtpHeaderExtension>& extensions);
293 bool SetChannelSendRtpHeaderExtensions(
294 int channel_id,
295 const std::vector<RtpHeaderExtension>& extensions);
296
solenberg566ef242015-11-06 15:34:49 -0800297 rtc::ThreadChecker worker_thread_checker_;
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200298
solenberg566ef242015-11-06 15:34:49 -0800299 WebRtcVoiceEngine* const engine_ = nullptr;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000300 std::vector<AudioCodec> recv_codecs_;
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000301 std::vector<AudioCodec> send_codecs_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000302 rtc::scoped_ptr<webrtc::CodecInst> send_codec_;
solenberg566ef242015-11-06 15:34:49 -0800303 bool send_bitrate_setting_ = false;
304 int send_bitrate_bps_ = 0;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000305 AudioOptions options_;
solenberg566ef242015-11-06 15:34:49 -0800306 bool dtmf_allowed_ = false;
307 bool desired_playout_ = false;
308 bool nack_enabled_ = false;
309 bool playout_ = false;
310 SendFlags desired_send_ = SEND_NOTHING;
311 SendFlags send_ = SEND_NOTHING;
312 webrtc::Call* const call_ = nullptr;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000313
solenberg1ac56142015-10-13 03:58:19 -0700314 // SSRC of unsignalled receive stream, or -1 if there isn't one.
315 int64_t default_recv_ssrc_ = -1;
316 // Volume for unsignalled stream, which may be set before the stream exists.
317 double default_recv_volume_ = 1.0;
solenberg0a617e22015-10-20 15:49:38 -0700318 // SSRC to use for RTCP receiver reports; default to 1 in case of no signaled
319 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740
320 uint32_t receiver_reports_ssrc_ = 1;
solenberg1ac56142015-10-13 03:58:19 -0700321
solenbergc96df772015-10-21 13:01:53 -0700322 class WebRtcAudioSendStream;
323 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_;
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000324 std::vector<RtpHeaderExtension> send_extensions_;
solenbergc96df772015-10-21 13:01:53 -0700325
326 class WebRtcAudioReceiveStream;
327 std::map<uint32_t, WebRtcAudioReceiveStream*> receive_channels_;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200328 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_;
329 std::map<uint32_t, StreamParams> receive_stream_params_;
henrike@webrtc.org1e09a712013-07-26 19:17:59 +0000330 // receive_channels_ can be read from WebRtc callback thread. Access from
331 // the WebRtc thread must be synchronized with edits on the worker thread.
332 // Reads on the worker thread are ok.
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000333 std::vector<RtpHeaderExtension> receive_extensions_;
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200334 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
solenbergc96df772015-10-21 13:01:53 -0700335
336 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000337};
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000338} // namespace cricket
339
340#endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_