blob: a8f3ec85115e388cf416d7cc24097e593673807e [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_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000175};
176
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000177// WebRtcVoiceMediaChannel is an implementation of VoiceMediaChannel that uses
178// WebRtc Voice Engine.
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200179class WebRtcVoiceMediaChannel : public VoiceMediaChannel,
180 public webrtc::Transport {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000181 public:
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200182 WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine,
183 const AudioOptions& options,
184 webrtc::Call* call);
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200185 ~WebRtcVoiceMediaChannel() override;
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200186
solenberg66f43392015-09-09 01:36:22 -0700187 const AudioOptions& options() const { return options_; }
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200188
Peter Thatcherc2ee2c82015-08-07 16:05:34 -0700189 bool SetSendParameters(const AudioSendParameters& params) override;
190 bool SetRecvParameters(const AudioRecvParameters& params) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200191 bool SetPlayout(bool playout) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000192 bool PausePlayout();
193 bool ResumePlayout();
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200194 bool SetSend(SendFlags send) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000195 bool PauseSend();
196 bool ResumeSend();
Peter Boström0c4e06b2015-10-07 12:23:21 +0200197 bool SetAudioSend(uint32_t ssrc,
198 bool enable,
199 const AudioOptions* options,
solenberg1dd98f32015-09-10 01:57:14 -0700200 AudioRenderer* renderer) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200201 bool AddSendStream(const StreamParams& sp) override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200202 bool RemoveSendStream(uint32_t ssrc) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200203 bool AddRecvStream(const StreamParams& sp) override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200204 bool RemoveRecvStream(uint32_t ssrc) override;
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200205 bool GetActiveStreams(AudioInfo::StreamList* actives) override;
206 int GetOutputLevel() override;
207 int GetTimeSinceLastTyping() override;
208 void SetTypingDetectionParameters(int time_window,
209 int cost_per_typing,
210 int reporting_threshold,
211 int penalty_decay,
212 int type_event_delay) override;
solenberg4bac9c52015-10-09 02:32:53 -0700213 bool SetOutputVolume(uint32_t ssrc, double volume) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000214
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200215 bool CanInsertDtmf() override;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200216 bool InsertDtmf(uint32_t ssrc, int event, int duration, int flags) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000217
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200218 void OnPacketReceived(rtc::Buffer* packet,
219 const rtc::PacketTime& packet_time) override;
220 void OnRtcpReceived(rtc::Buffer* packet,
221 const rtc::PacketTime& packet_time) override;
222 void OnReadyToSend(bool ready) override {}
Fredrik Solenbergaaf8ff22015-05-07 16:05:53 +0200223 bool GetStats(VoiceMediaInfo* info) override;
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200224
225 // implements Transport interface
stefan1d8a5062015-10-02 03:39:33 -0700226 bool SendRtp(const uint8_t* data,
227 size_t len,
228 const webrtc::PacketOptions& options) override {
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200229 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
230 kMaxRtpPacketLen);
stefanc1aeaf02015-10-15 07:26:07 -0700231 rtc::PacketOptions rtc_options;
232 rtc_options.packet_id = options.packet_id;
233 return VoiceMediaChannel::SendPacket(&packet, rtc_options);
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200234 }
235
pbos2d566682015-09-28 09:59:31 -0700236 bool SendRtcp(const uint8_t* data, size_t len) override {
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200237 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
238 kMaxRtpPacketLen);
stefanc1aeaf02015-10-15 07:26:07 -0700239 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions());
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200240 }
241
solenbergd97ec302015-10-07 01:40:33 -0700242 void OnError(int error);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000243
Peter Boström0c4e06b2015-10-07 12:23:21 +0200244 int GetReceiveChannelId(uint32_t ssrc) const;
245 int GetSendChannelId(uint32_t ssrc) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000246
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200247 private:
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200248 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
249 bool SetSendRtpHeaderExtensions(
250 const std::vector<RtpHeaderExtension>& extensions);
251 bool SetOptions(const AudioOptions& options);
252 bool SetMaxSendBandwidth(int bps);
253 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
254 bool SetRecvRtpHeaderExtensions(
255 const std::vector<RtpHeaderExtension>& extensions);
Peter Boström0c4e06b2015-10-07 12:23:21 +0200256 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer);
257 bool MuteStream(uint32_t ssrc, bool mute);
Fredrik Solenbergb071a192015-09-17 16:42:56 +0200258
Fredrik Solenberge444a3d2015-05-07 16:42:08 +0200259 WebRtcVoiceEngine* engine() { return engine_; }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000260 int GetLastEngineError() { return engine()->GetLastEngineError(); }
261 int GetOutputLevel(int channel);
262 bool GetRedSendCodec(const AudioCodec& red_codec,
263 const std::vector<AudioCodec>& all_codecs,
264 webrtc::CodecInst* send_codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000265 bool SetPlayout(int channel, bool playout);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000266 static Error WebRtcErrorToChannelError(int err_code);
267
mallinath@webrtc.org67ee6b92014-02-03 16:57:16 +0000268 class WebRtcVoiceChannelRenderer;
269 // Map of ssrc to WebRtcVoiceChannelRenderer object. A new object of
270 // WebRtcVoiceChannelRenderer will be created for every new stream and
271 // will be destroyed when the stream goes away.
Peter Boström0c4e06b2015-10-07 12:23:21 +0200272 typedef std::map<uint32_t, WebRtcVoiceChannelRenderer*> ChannelMap;
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000273 typedef int (webrtc::VoERTP_RTCP::* ExtensionSetterFunction)(int, bool,
274 unsigned char);
henrike@webrtc.org1e09a712013-07-26 19:17:59 +0000275
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000276 void SetNack(int channel, bool nack_enabled);
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000277 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000278 bool ChangePlayout(bool playout);
279 bool ChangeSend(SendFlags send);
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000280 bool ChangeSend(int channel, SendFlags send);
wu@webrtc.org78187522013-10-07 23:32:02 +0000281 bool ConfigureRecvChannel(int channel);
solenberg0a617e22015-10-20 15:49:38 -0700282 int CreateVoEChannel();
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000283 bool DeleteChannel(int channel);
solenberg1ac56142015-10-13 03:58:19 -0700284 bool IsDefaultRecvStream(uint32_t ssrc) {
285 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
286 }
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000287 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs);
minyue@webrtc.org26236952014-10-29 02:27:08 +0000288 bool SetSendBitrateInternal(int bps);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000289
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000290 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id,
291 const RtpHeaderExtension* extension);
Fredrik Solenberg709ed672015-09-15 12:26:33 +0200292 void RecreateAudioReceiveStreams();
Peter Boström0c4e06b2015-10-07 12:23:21 +0200293 void AddAudioReceiveStream(uint32_t ssrc);
294 void RemoveAudioReceiveStream(uint32_t ssrc);
Fredrik Solenbergaf9fb212015-08-26 10:45:53 +0200295 bool SetRecvCodecsInternal(const std::vector<AudioCodec>& new_codecs);
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200296
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000297 bool SetChannelRecvRtpHeaderExtensions(
298 int channel_id,
299 const std::vector<RtpHeaderExtension>& extensions);
300 bool SetChannelSendRtpHeaderExtensions(
301 int channel_id,
302 const std::vector<RtpHeaderExtension>& extensions);
303
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200304 rtc::ThreadChecker thread_checker_;
305
Fredrik Solenberg709ed672015-09-15 12:26:33 +0200306 WebRtcVoiceEngine* const engine_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000307 std::vector<AudioCodec> recv_codecs_;
wu@webrtc.orgcadf9042013-08-30 21:24:16 +0000308 std::vector<AudioCodec> send_codecs_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000309 rtc::scoped_ptr<webrtc::CodecInst> send_codec_;
minyue@webrtc.org26236952014-10-29 02:27:08 +0000310 bool send_bitrate_setting_;
311 int send_bitrate_bps_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000312 AudioOptions options_;
313 bool dtmf_allowed_;
314 bool desired_playout_;
315 bool nack_enabled_;
316 bool playout_;
wu@webrtc.org967bfff2013-09-19 05:49:50 +0000317 bool typing_noise_detected_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000318 SendFlags desired_send_;
319 SendFlags send_;
Fredrik Solenberg709ed672015-09-15 12:26:33 +0200320 webrtc::Call* const call_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000321
solenberg1ac56142015-10-13 03:58:19 -0700322 // SSRC of unsignalled receive stream, or -1 if there isn't one.
323 int64_t default_recv_ssrc_ = -1;
324 // Volume for unsignalled stream, which may be set before the stream exists.
325 double default_recv_volume_ = 1.0;
solenberg0a617e22015-10-20 15:49:38 -0700326 // SSRC to use for RTCP receiver reports; default to 1 in case of no signaled
327 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740
328 uint32_t receiver_reports_ssrc_ = 1;
solenberg1ac56142015-10-13 03:58:19 -0700329
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000330 // send_channels_ contains the channels which are being used for sending.
solenberg8fb30c32015-10-13 03:06:58 -0700331 // When the default channel (default_send_channel_id) is used for sending, it
332 // is contained in send_channels_, otherwise not.
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000333 ChannelMap send_channels_;
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000334 std::vector<RtpHeaderExtension> send_extensions_;
solenberg1ac56142015-10-13 03:58:19 -0700335 ChannelMap receive_channels_;
Peter Boström0c4e06b2015-10-07 12:23:21 +0200336 std::map<uint32_t, webrtc::AudioReceiveStream*> receive_streams_;
337 std::map<uint32_t, StreamParams> receive_stream_params_;
henrike@webrtc.org1e09a712013-07-26 19:17:59 +0000338 // receive_channels_ can be read from WebRtc callback thread. Access from
339 // the WebRtc thread must be synchronized with edits on the worker thread.
340 // Reads on the worker thread are ok.
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000341 std::vector<RtpHeaderExtension> receive_extensions_;
Fredrik Solenberg4b60c732015-05-07 14:07:48 +0200342 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000343};
344
345} // namespace cricket
346
347#endif // TALK_MEDIA_WEBRTCVOICEENGINE_H_