blob: a70840565b433c6188152eecd41719d416ee2cf2 [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"
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000040#include "webrtc/base/buffer.h"
41#include "webrtc/base/byteorder.h"
42#include "webrtc/base/logging.h"
43#include "webrtc/base/scoped_ptr.h"
44#include "webrtc/base/stream.h"
Fredrik Solenberg4b60c732015-05-07 14:07:48 +020045#include "webrtc/base/thread_checker.h"
46#include "webrtc/call.h"
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000047#include "webrtc/common.h"
Henrik Lundin64dad832015-05-11 12:44:23 +020048#include "webrtc/config.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000049
henrike@webrtc.org28e20752013-07-10 00:45:36 +000050namespace cricket {
51
henrike@webrtc.org28e20752013-07-10 00:45:36 +000052class AudioDeviceModule;
henrike@webrtc.org1e09a712013-07-26 19:17:59 +000053class AudioRenderer;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000054class VoETraceWrapper;
55class VoEWrapper;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000056class WebRtcVoiceMediaChannel;
57
58// WebRtcVoiceEngine is a class to be used with CompositeMediaEngine.
59// It uses the WebRtc VoiceEngine library for audio handling.
60class WebRtcVoiceEngine
61 : public webrtc::VoiceEngineObserver,
Fredrik Solenberg7d173362015-09-23 12:23:21 +020062 public webrtc::TraceCallback {
Jelena Marusicc28a8962015-05-29 15:05:44 +020063 friend class WebRtcVoiceMediaChannel;
64
henrike@webrtc.org28e20752013-07-10 00:45:36 +000065 public:
66 WebRtcVoiceEngine();
67 // Dependency injection for testing.
Fredrik Solenbergccb49e72015-05-19 11:37:56 +020068 WebRtcVoiceEngine(VoEWrapper* voe_wrapper, VoETraceWrapper* tracing);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000069 ~WebRtcVoiceEngine();
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000070 bool Init(rtc::Thread* worker_thread);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000071 void Terminate();
72
Fredrik Solenberg709ed672015-09-15 12:26:33 +020073 webrtc::VoiceEngine* GetVoE() { return voe()->engine(); }
74 VoiceMediaChannel* CreateChannel(webrtc::Call* call,
75 const AudioOptions& options);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000076
mallinath@webrtc.orga27be8e2013-09-27 23:04:10 +000077 AudioOptions GetOptions() const { return options_; }
78 bool SetOptions(const AudioOptions& options);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000079 bool SetDevices(const Device* in_device, const Device* out_device);
80 bool GetOutputVolume(int* level);
81 bool SetOutputVolume(int level);
82 int GetInputLevel();
henrike@webrtc.org28e20752013-07-10 00:45:36 +000083
84 const std::vector<AudioCodec>& codecs();
85 bool FindCodec(const AudioCodec& codec);
86 bool FindWebRtcCodec(const AudioCodec& codec, webrtc::CodecInst* gcodec);
87
88 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;
89
90 void SetLogging(int min_sev, const char* filter);
91
henrike@webrtc.org28e20752013-07-10 00:45:36 +000092 // For tracking WebRtc channels. Needed because we have to pause them
93 // all when switching devices.
94 // May only be called by WebRtcVoiceMediaChannel.
solenberg63b34542015-09-29 06:06:31 -070095 void RegisterChannel(WebRtcVoiceMediaChannel* channel);
96 void UnregisterChannel(WebRtcVoiceMediaChannel* channel);
henrike@webrtc.org28e20752013-07-10 00:45:36 +000097
henrike@webrtc.org28e20752013-07-10 00:45:36 +000098 // Called by WebRtcVoiceMediaChannel to set a gain offset from
99 // the default AGC target level.
100 bool AdjustAgcLevel(int delta);
101
102 VoEWrapper* voe() { return voe_wrapper_.get(); }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000103 int GetLastEngineError();
104
Fredrik Solenbergccb49e72015-05-19 11:37:56 +0200105 // Set the external ADM. This can only be called before Init.
106 bool SetAudioDeviceModule(webrtc::AudioDeviceModule* adm);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000107
wu@webrtc.orga9890802013-12-13 00:21:03 +0000108 // Starts AEC dump using existing file.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000109 bool StartAecDump(rtc::PlatformFile file);
wu@webrtc.orga9890802013-12-13 00:21:03 +0000110
ivoc112a3d82015-10-16 02:22:18 -0700111 // Starts recording an RtcEventLog using an existing file until 10 minutes
112 // pass or the StopRtcEventLog function is called.
113 bool StartRtcEventLog(rtc::PlatformFile file);
114
115 // Stops recording the RtcEventLog.
116 void StopRtcEventLog();
117
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000118 private:
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000119 void Construct();
120 void ConstructCodecs();
henrik.lundin@webrtc.org8038d422014-11-11 08:38:24 +0000121 bool GetVoeCodec(int index, webrtc::CodecInst* codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000122 bool InitInternal();
123 void SetTraceFilter(int filter);
124 void SetTraceOptions(const std::string& options);
solenberg63b34542015-09-29 06:06:31 -0700125 // Every option that is "set" will be applied. Every option not "set" will be
126 // ignored. This allows us to selectively turn on and off different options
127 // easily at any time.
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000128 bool ApplyOptions(const AudioOptions& options);
xians@webrtc.org3cefbc92014-10-10 09:42:53 +0000129
130 // webrtc::TraceCallback:
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000131 void Print(webrtc::TraceLevel level, const char* trace, int length) override;
xians@webrtc.org3cefbc92014-10-10 09:42:53 +0000132
133 // webrtc::VoiceEngineObserver:
solenbergd97ec302015-10-07 01:40:33 -0700134 void CallbackOnError(int channel_id, int errCode) override;
xians@webrtc.org3cefbc92014-10-10 09:42:53 +0000135
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000136 // Given the device type, name, and id, find device id. Return true and
137 // set the output parameter rtc_id if successful.
138 bool FindWebRtcAudioDeviceId(
139 bool is_input, const std::string& dev_name, int dev_id, int* rtc_id);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000140
141 void StartAecDump(const std::string& filename);
142 void StopAecDump();
solenberg0a617e22015-10-20 15:49:38 -0700143 int CreateVoEChannel();
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000144
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000145 static const int kDefaultLogSeverity = rtc::LS_WARNING;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000146
147 // The primary instance of WebRtc VoiceEngine.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000148 rtc::scoped_ptr<VoEWrapper> voe_wrapper_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000149 rtc::scoped_ptr<VoETraceWrapper> tracing_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000150 // The external audio device manager
151 webrtc::AudioDeviceModule* adm_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000152 int log_filter_;
153 std::string log_options_;
154 bool is_dumping_aec_;
155 std::vector<AudioCodec> codecs_;
156 std::vector<RtpHeaderExtension> rtp_header_extensions_;
solenberg63b34542015-09-29 06:06:31 -0700157 std::vector<WebRtcVoiceMediaChannel*> channels_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000158 // channels_ can be read from WebRtc callback thread. We need a lock on that
159 // callback as well as the RegisterChannel/UnregisterChannel.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000160 rtc::CriticalSection channels_cs_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000161 webrtc::AgcConfig default_agc_config_;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000162
163 webrtc::Config voe_config_;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000164
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000165 bool initialized_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000166 AudioOptions options_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000167
Henrik Lundin441f6342015-06-09 16:03:13 +0200168 // Cache received extended_filter_aec, delay_agnostic_aec and experimental_ns
Bjorn Volckerbf395c12015-03-25 22:45:56 +0100169 // values, and apply them in case they are missing in the audio options. We
170 // need to do this because SetExtraOptions() will revert to defaults for
171 // options which are not provided.
Henrik Lundin441f6342015-06-09 16:03:13 +0200172 Settable<bool> extended_filter_aec_;
Bjorn Volckerbf395c12015-03-25 22:45:56 +0100173 Settable<bool> delay_agnostic_aec_;
buildbot@webrtc.org1f8a2372014-08-28 10:52:44 +0000174 Settable<bool> experimental_ns_;
solenbergc96df772015-10-21 13:01:53 -0700175
176 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcVoiceEngine);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000177};
178
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000179// WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses
180// WebRtc Voice Engine.
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200181class WebRtcVoiceMediaChannel : public VoiceMediaChannel,
182 public webrtc::Transport {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000183 public:
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200184 WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine,
185 const AudioOptions& options,
186 webrtc::Call* call);
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200187 ~WebRtcVoiceMediaChannel() override;
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200188
solenberg66f43392015-09-09 01:36:22 -0700189 const AudioOptions& options() const { return options_; }
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200190
Peter Thatcherc2ee2c82015-08-07 16:05:34 -0700191 bool SetSendParameters(const AudioSendParameters& params) override;
192 bool SetRecvParameters(const AudioRecvParameters& params) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200193 bool SetPlayout(bool playout) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000194 bool PausePlayout();
195 bool ResumePlayout();
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200196 bool SetSend(SendFlags send) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000197 bool PauseSend();
198 bool ResumeSend();
Peter Boström0c4e06b2015-10-07 12:23:21 +0200199 bool SetAudioSend(uint32_t ssrc,
200 bool enable,
201 const AudioOptions* options,
solenberg1dd98f32015-09-10 01:57:14 -0700202 AudioRenderer* renderer) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200203 bool AddSendStream(const StreamParams& sp) override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200204 bool RemoveSendStream(uint32_t ssrc) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200205 bool AddRecvStream(const StreamParams& sp) override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200206 bool RemoveRecvStream(uint32_t ssrc) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200207 bool GetActiveStreams(AudioInfo::StreamList* actives) override;
208 int GetOutputLevel() override;
209 int GetTimeSinceLastTyping() override;
210 void SetTypingDetectionParameters(int time_window,
211 int cost_per_typing,
212 int reporting_threshold,
213 int penalty_decay,
214 int type_event_delay) override;
solenberg4bac9c52015-10-09 02:32:53 -0700215 bool SetOutputVolume(uint32_t ssrc, double volume) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000216
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200217 bool CanInsertDtmf() override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200218 bool InsertDtmf(uint32_t ssrc, int event, int duration, int flags) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000219
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200220 void OnPacketReceived(rtc::Buffer* packet,
221 const rtc::PacketTime& packet_time) override;
222 void OnRtcpReceived(rtc::Buffer* packet,
223 const rtc::PacketTime& packet_time) override;
224 void OnReadyToSend(bool ready) override {}
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200225 bool GetStats(VoiceMediaInfo* info) override;
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200226
227 // implements Transport interface
stefan1d8a5062015-10-02 03:39:33 -0700228 bool SendRtp(const uint8_t* data,
229 size_t len,
230 const webrtc::PacketOptions& options) override {
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200231 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
232 kMaxRtpPacketLen);
stefanc1aeaf02015-10-15 07:26:07 -0700233 rtc::PacketOptions rtc_options;
234 rtc_options.packet_id = options.packet_id;
235 return VoiceMediaChannel::SendPacket(&packet, rtc_options);
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200236 }
237
pbos2d566682015-09-28 09:59:31 -0700238 bool SendRtcp(const uint8_t* data, size_t len) override {
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200239 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
240 kMaxRtpPacketLen);
stefanc1aeaf02015-10-15 07:26:07 -0700241 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions());
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200242 }
243
solenbergd97ec302015-10-07 01:40:33 -0700244 void OnError(int error);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000245
Peter Boström0c4e06b2015-10-07 12:23:21 +0200246 int GetReceiveChannelId(uint32_t ssrc) const;
247 int GetSendChannelId(uint32_t ssrc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000248
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200249 private:
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200250 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
251 bool SetSendRtpHeaderExtensions(
252 const std::vector<RtpHeaderExtension>& extensions);
253 bool SetOptions(const AudioOptions& options);
254 bool SetMaxSendBandwidth(int bps);
255 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
256 bool SetRecvRtpHeaderExtensions(
257 const std::vector<RtpHeaderExtension>& extensions);
Peter Boström0c4e06b2015-10-07 12:23:21 +0200258 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer);
259 bool MuteStream(uint32_t ssrc, bool mute);
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200260
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200261 WebRtcVoiceEngine* engine() { return engine_; }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000262 int GetLastEngineError() { return engine()->GetLastEngineError(); }
263 int GetOutputLevel(int channel);
264 bool GetRedSendCodec(const AudioCodec& red_codec,
265 const std::vector<AudioCodec>& all_codecs,
266 webrtc::CodecInst* send_codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000267 bool SetPlayout(int channel, bool playout);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000268 static Error WebRtcErrorToChannelError(int err_code);
269
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000270 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool,
271 unsigned char);
henrike@webrtc.org1e09a712013-07-26 19:17:59 +0000272
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000273 void SetNack(int channel, bool nack_enabled);
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000274 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000275 bool ChangePlayout(bool playout);
276 bool ChangeSend(SendFlags send);
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000277 bool ChangeSend(int channel, SendFlags send);
wu@webrtc.org78187522013-10-07 23:32:02 +0000278 bool ConfigureRecvChannel(int channel);
solenberg0a617e22015-10-20 15:49:38 -0700279 int CreateVoEChannel();
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000280 bool DeleteChannel(int channel);
solenberg1ac56142015-10-13 03:58:19 -0700281 bool IsDefaultRecvStream(uint32_t ssrc) {
282 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
283 }
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000284 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs);
minyue@webrtc.org26236952014-10-29 02:27:08 +0000285 bool SetSendBitrateInternal(int bps);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000286
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000287 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id,
288 const RtpHeaderExtension* extension);
Fredrik Solenberg709ed672015-09-15 12:26:33 +0200289 void RecreateAudioReceiveStreams();
Peter Boström0c4e06b2015-10-07 12:23:21 +0200290 void AddAudioReceiveStream(uint32_t ssrc);
291 void RemoveAudioReceiveStream(uint32_t ssrc);
Fredrik Solenbergaf9fb212015-08-26 10:45:53 +0200292 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs);
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200293
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000294 bool SetChannelRecvRtpHeaderExtensions(
295 int channel_id,
296 const std::vector<RtpHeaderExtension>& extensions);
297 bool SetChannelSendRtpHeaderExtensions(
298 int channel_id,
299 const std::vector<RtpHeaderExtension>& extensions);
300
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200301 rtc::ThreadChecker thread_checker_;
302
Fredrik Solenberg709ed672015-09-15 12:26:33 +0200303 WebRtcVoiceEngine* const engine_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000304 std::vector<AudioCodec> recv_codecs_;
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000305 std::vector<AudioCodec> send_codecs_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000306 rtc::scoped_ptr<webrtc::CodecInst> send_codec_;
minyue@webrtc.org26236952014-10-29 02:27:08 +0000307 bool send_bitrate_setting_;
308 int send_bitrate_bps_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000309 AudioOptions options_;
310 bool dtmf_allowed_;
311 bool desired_playout_;
312 bool nack_enabled_;
313 bool playout_;
wu@webrtc.org967bfff2013-09-19 05:49:50 +0000314 bool typing_noise_detected_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000315 SendFlags desired_send_;
316 SendFlags send_;
Fredrik Solenberg709ed672015-09-15 12:26:33 +0200317 webrtc::Call* const call_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000318
solenberg1ac56142015-10-13 03:58:19 -0700319 // SSRC of unsignalled receive stream, or -1 if there isn't one.
320 int64_t default_recv_ssrc_ = -1;
321 // Volume for unsignalled stream, which may be set before the stream exists.
322 double default_recv_volume_ = 1.0;
solenberg0a617e22015-10-20 15:49:38 -0700323 // SSRC to use for RTCP receiver reports; default to 1 in case of no signaled
324 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740
325 uint32_t receiver_reports_ssrc_ = 1;
solenberg1ac56142015-10-13 03:58:19 -0700326
solenbergc96df772015-10-21 13:01:53 -0700327 class WebRtcAudioSendStream;
328 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_;
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000329 std::vector<RtpHeaderExtension> send_extensions_;
solenbergc96df772015-10-21 13:01:53 -0700330
331 class WebRtcAudioReceiveStream;
332 std::map<uint32_t, WebRtcAudioReceiveStream*> receive_channels_;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200333 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_;
334 std::map<uint32_t, StreamParams> receive_stream_params_;
henrike@webrtc.org1e09a712013-07-26 19:17:59 +0000335 // receive_channels_ can be read from WebRtc callback thread. Access from
336 // the WebRtc thread must be synchronized with edits on the worker thread.
337 // Reads on the worker thread are ok.
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000338 std::vector<RtpHeaderExtension> receive_extensions_;
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200339 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
solenbergc96df772015-10-21 13:01:53 -0700340
341 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000342};
343
344} // namespace cricket
345
346#endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_