blob: d2e26cdc950cb5320945f08faaf3c039408f9085 [file] [log] [blame]
solenbergc7a8b082015-10-16 14:35:07 -07001/*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "audio/audio_send_stream.h"
solenbergc7a8b082015-10-16 14:35:07 -070012
13#include <string>
ossu20a4b3f2017-04-27 02:08:52 -070014#include <utility>
15#include <vector>
solenbergc7a8b082015-10-16 14:35:07 -070016
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "audio/audio_state.h"
Fredrik Solenberga8b7c7f2018-01-17 11:18:31 +010018#include "audio/channel_proxy.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "audio/conversion.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "call/rtp_transport_controller_send_interface.h"
21#include "modules/audio_coding/codecs/cng/audio_encoder_cng.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020022#include "rtc_base/checks.h"
23#include "rtc_base/event.h"
24#include "rtc_base/function_view.h"
25#include "rtc_base/logging.h"
Jonas Olssonabbe8412018-04-03 13:40:05 +020026#include "rtc_base/strings/audio_format_to_string.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020027#include "rtc_base/task_queue.h"
28#include "rtc_base/timeutils.h"
Alex Narestcedd3512017-12-07 20:54:55 +010029#include "system_wrappers/include/field_trial.h"
solenbergc7a8b082015-10-16 14:35:07 -070030
31namespace webrtc {
solenbergc7a8b082015-10-16 14:35:07 -070032namespace internal {
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +010033namespace {
eladalonedd6eea2017-05-25 00:15:35 -070034// TODO(eladalon): Subsequent CL will make these values experiment-dependent.
elad.alond12a8e12017-03-23 11:04:48 -070035constexpr size_t kPacketLossTrackerMaxWindowSizeMs = 15000;
36constexpr size_t kPacketLossRateMinNumAckedPackets = 50;
37constexpr size_t kRecoverablePacketLossRateMinNumAckedPairs = 40;
38
ossu20a4b3f2017-04-27 02:08:52 -070039void CallEncoder(const std::unique_ptr<voe::ChannelProxy>& channel_proxy,
40 rtc::FunctionView<void(AudioEncoder*)> lambda) {
41 channel_proxy->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder_ptr) {
42 RTC_DCHECK(encoder_ptr);
43 lambda(encoder_ptr->get());
44 });
45}
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +010046
47std::unique_ptr<voe::ChannelProxy> CreateChannelAndProxy(
48 webrtc::AudioState* audio_state,
49 rtc::TaskQueue* worker_queue,
Tommi5f223652018-03-26 13:28:26 +020050 ProcessThread* module_process_thread,
51 RtcpRttStats* rtcp_rtt_stats) {
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +010052 RTC_DCHECK(audio_state);
53 internal::AudioState* internal_audio_state =
54 static_cast<internal::AudioState*>(audio_state);
Tommi5f223652018-03-26 13:28:26 +020055 return std::unique_ptr<voe::ChannelProxy>(
56 new voe::ChannelProxy(std::unique_ptr<voe::Channel>(new voe::Channel(
57 worker_queue, module_process_thread,
58 internal_audio_state->audio_device_module(), rtcp_rtt_stats))));
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +010059}
ossu20a4b3f2017-04-27 02:08:52 -070060} // namespace
61
Sam Zackrisson06953ba2018-02-01 16:53:16 +010062// Helper class to track the actively sending lifetime of this stream.
sazac58f8c02017-07-19 00:39:19 -070063class AudioSendStream::TimedTransport : public Transport {
64 public:
65 TimedTransport(Transport* transport, TimeInterval* time_interval)
66 : transport_(transport), lifetime_(time_interval) {}
67 bool SendRtp(const uint8_t* packet,
68 size_t length,
69 const PacketOptions& options) {
70 if (lifetime_) {
71 lifetime_->Extend();
72 }
73 return transport_->SendRtp(packet, length, options);
74 }
75 bool SendRtcp(const uint8_t* packet, size_t length) {
76 return transport_->SendRtcp(packet, length);
77 }
78 ~TimedTransport() {}
79
80 private:
81 Transport* transport_;
82 TimeInterval* lifetime_;
83};
84
solenberg566ef242015-11-06 15:34:49 -080085AudioSendStream::AudioSendStream(
86 const webrtc::AudioSendStream::Config& config,
Stefan Holmerb86d4e42015-12-07 10:26:18 +010087 const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
perkj26091b12016-09-01 01:17:40 -070088 rtc::TaskQueue* worker_queue,
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +010089 ProcessThread* module_process_thread,
nisseb8f9a322017-03-27 05:36:15 -070090 RtpTransportControllerSendInterface* transport,
tereliuse035e2d2016-09-21 06:51:47 -070091 BitrateAllocator* bitrate_allocator,
michaelt9332b7d2016-11-30 07:51:13 -080092 RtcEventLog* event_log,
ossuc3d4b482017-05-23 06:07:11 -070093 RtcpRttStats* rtcp_rtt_stats,
Danil Chapovalovb9b146c2018-06-15 12:28:07 +020094 const absl::optional<RtpState>& suspended_rtp_state,
Sam Zackrisson06953ba2018-02-01 16:53:16 +010095 TimeInterval* overall_call_lifetime)
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +010096 : AudioSendStream(config,
97 audio_state,
98 worker_queue,
99 transport,
100 bitrate_allocator,
101 event_log,
102 rtcp_rtt_stats,
103 suspended_rtp_state,
Sam Zackrisson06953ba2018-02-01 16:53:16 +0100104 overall_call_lifetime,
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +0100105 CreateChannelAndProxy(audio_state.get(),
106 worker_queue,
Tommi5f223652018-03-26 13:28:26 +0200107 module_process_thread,
108 rtcp_rtt_stats)) {}
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +0100109
110AudioSendStream::AudioSendStream(
111 const webrtc::AudioSendStream::Config& config,
112 const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
113 rtc::TaskQueue* worker_queue,
114 RtpTransportControllerSendInterface* transport,
115 BitrateAllocator* bitrate_allocator,
116 RtcEventLog* event_log,
117 RtcpRttStats* rtcp_rtt_stats,
Danil Chapovalovb9b146c2018-06-15 12:28:07 +0200118 const absl::optional<RtpState>& suspended_rtp_state,
Sam Zackrisson06953ba2018-02-01 16:53:16 +0100119 TimeInterval* overall_call_lifetime,
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +0100120 std::unique_ptr<voe::ChannelProxy> channel_proxy)
perkj26091b12016-09-01 01:17:40 -0700121 : worker_queue_(worker_queue),
ossu20a4b3f2017-04-27 02:08:52 -0700122 config_(Config(nullptr)),
mflodman86cc6ff2016-07-26 04:44:06 -0700123 audio_state_(audio_state),
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +0100124 channel_proxy_(std::move(channel_proxy)),
ossu20a4b3f2017-04-27 02:08:52 -0700125 event_log_(event_log),
michaeltf4caaab2017-01-16 23:55:07 -0800126 bitrate_allocator_(bitrate_allocator),
nisseb8f9a322017-03-27 05:36:15 -0700127 transport_(transport),
elad.alond12a8e12017-03-23 11:04:48 -0700128 packet_loss_tracker_(kPacketLossTrackerMaxWindowSizeMs,
129 kPacketLossRateMinNumAckedPackets,
ossuc3d4b482017-05-23 06:07:11 -0700130 kRecoverablePacketLossRateMinNumAckedPairs),
131 rtp_rtcp_module_(nullptr),
Sam Zackrisson06953ba2018-02-01 16:53:16 +0100132 suspended_rtp_state_(suspended_rtp_state),
133 overall_call_lifetime_(overall_call_lifetime) {
Jonas Olsson24ea8222018-01-25 10:14:29 +0100134 RTC_LOG(LS_INFO) << "AudioSendStream: " << config.rtp.ssrc;
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +0100135 RTC_DCHECK(worker_queue_);
136 RTC_DCHECK(audio_state_);
137 RTC_DCHECK(channel_proxy_);
138 RTC_DCHECK(bitrate_allocator_);
nisseb8f9a322017-03-27 05:36:15 -0700139 RTC_DCHECK(transport);
Sam Zackrisson06953ba2018-02-01 16:53:16 +0100140 RTC_DCHECK(overall_call_lifetime_);
solenberg3a941542015-11-16 07:34:50 -0800141
ossu20a4b3f2017-04-27 02:08:52 -0700142 channel_proxy_->SetRtcEventLog(event_log_);
solenberg13725082015-11-25 08:16:52 -0800143 channel_proxy_->SetRTCPStatus(true);
ossuc3d4b482017-05-23 06:07:11 -0700144 RtpReceiver* rtpReceiver = nullptr; // Unused, but required for call.
145 channel_proxy_->GetRtpRtcp(&rtp_rtcp_module_, &rtpReceiver);
146 RTC_DCHECK(rtp_rtcp_module_);
mflodman3d7db262016-04-29 00:57:13 -0700147
ossu20a4b3f2017-04-27 02:08:52 -0700148 ConfigureStream(this, config, true);
elad.alond12a8e12017-03-23 11:04:48 -0700149
150 pacer_thread_checker_.DetachFromThread();
Danil Chapovalov90e1f532017-10-03 14:59:27 +0200151 // Signal congestion controller this object is ready for OnPacket* callbacks.
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100152 transport_->RegisterPacketFeedbackObserver(this);
solenbergc7a8b082015-10-16 14:35:07 -0700153}
154
155AudioSendStream::~AudioSendStream() {
elad.alond12a8e12017-03-23 11:04:48 -0700156 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
Jonas Olsson24ea8222018-01-25 10:14:29 +0100157 RTC_LOG(LS_INFO) << "~AudioSendStream: " << config_.rtp.ssrc;
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100158 RTC_DCHECK(!sending_);
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100159 transport_->DeRegisterPacketFeedbackObserver(this);
solenberg1c239d42017-09-29 06:00:28 -0700160 channel_proxy_->RegisterTransport(nullptr);
nissefdbfdc92017-03-31 05:44:52 -0700161 channel_proxy_->ResetSenderCongestionControlObjects();
tereliuse035e2d2016-09-21 06:51:47 -0700162 channel_proxy_->SetRtcEventLog(nullptr);
Sam Zackrisson06953ba2018-02-01 16:53:16 +0100163 // Lifetime can only be updated after deregistering
164 // |timed_send_transport_adapter_| in the underlying channel object to avoid
165 // data races in |active_lifetime_|.
166 overall_call_lifetime_->Extend(active_lifetime_);
solenbergc7a8b082015-10-16 14:35:07 -0700167}
168
eladalonabbc4302017-07-26 02:09:44 -0700169const webrtc::AudioSendStream::Config& AudioSendStream::GetConfig() const {
170 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
171 return config_;
172}
173
ossu20a4b3f2017-04-27 02:08:52 -0700174void AudioSendStream::Reconfigure(
175 const webrtc::AudioSendStream::Config& new_config) {
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100176 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
ossu20a4b3f2017-04-27 02:08:52 -0700177 ConfigureStream(this, new_config, false);
178}
179
Alex Narestcedd3512017-12-07 20:54:55 +0100180AudioSendStream::ExtensionIds AudioSendStream::FindExtensionIds(
181 const std::vector<RtpExtension>& extensions) {
182 ExtensionIds ids;
183 for (const auto& extension : extensions) {
184 if (extension.uri == RtpExtension::kAudioLevelUri) {
185 ids.audio_level = extension.id;
186 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) {
187 ids.transport_sequence_number = extension.id;
Steve Antonbb50ce52018-03-26 10:24:32 -0700188 } else if (extension.uri == RtpExtension::kMidUri) {
189 ids.mid = extension.id;
Alex Narestcedd3512017-12-07 20:54:55 +0100190 }
191 }
192 return ids;
193}
194
ossu20a4b3f2017-04-27 02:08:52 -0700195void AudioSendStream::ConfigureStream(
196 webrtc::internal::AudioSendStream* stream,
197 const webrtc::AudioSendStream::Config& new_config,
198 bool first_time) {
Jonas Olsson24ea8222018-01-25 10:14:29 +0100199 RTC_LOG(LS_INFO) << "AudioSendStream::ConfigureStream: "
200 << new_config.ToString();
ossu20a4b3f2017-04-27 02:08:52 -0700201 const auto& channel_proxy = stream->channel_proxy_;
202 const auto& old_config = stream->config_;
203
204 if (first_time || old_config.rtp.ssrc != new_config.rtp.ssrc) {
205 channel_proxy->SetLocalSSRC(new_config.rtp.ssrc);
ossuc3d4b482017-05-23 06:07:11 -0700206 if (stream->suspended_rtp_state_) {
207 stream->rtp_rtcp_module_->SetRtpState(*stream->suspended_rtp_state_);
208 }
ossu20a4b3f2017-04-27 02:08:52 -0700209 }
210 if (first_time || old_config.rtp.c_name != new_config.rtp.c_name) {
211 channel_proxy->SetRTCP_CNAME(new_config.rtp.c_name);
212 }
213 // TODO(solenberg): Config NACK history window (which is a packet count),
214 // using the actual packet size for the configured codec.
215 if (first_time || old_config.rtp.nack.rtp_history_ms !=
216 new_config.rtp.nack.rtp_history_ms) {
217 channel_proxy->SetNACKStatus(new_config.rtp.nack.rtp_history_ms != 0,
218 new_config.rtp.nack.rtp_history_ms / 20);
219 }
220
Yves Gerey665174f2018-06-19 15:03:05 +0200221 if (first_time || new_config.send_transport != old_config.send_transport) {
ossu20a4b3f2017-04-27 02:08:52 -0700222 if (old_config.send_transport) {
solenberg1c239d42017-09-29 06:00:28 -0700223 channel_proxy->RegisterTransport(nullptr);
ossu20a4b3f2017-04-27 02:08:52 -0700224 }
sazac58f8c02017-07-19 00:39:19 -0700225 if (new_config.send_transport) {
226 stream->timed_send_transport_adapter_.reset(new TimedTransport(
227 new_config.send_transport, &stream->active_lifetime_));
228 } else {
229 stream->timed_send_transport_adapter_.reset(nullptr);
230 }
solenberg1c239d42017-09-29 06:00:28 -0700231 channel_proxy->RegisterTransport(
sazac58f8c02017-07-19 00:39:19 -0700232 stream->timed_send_transport_adapter_.get());
ossu20a4b3f2017-04-27 02:08:52 -0700233 }
234
Alex Narestcedd3512017-12-07 20:54:55 +0100235 const ExtensionIds old_ids = FindExtensionIds(old_config.rtp.extensions);
236 const ExtensionIds new_ids = FindExtensionIds(new_config.rtp.extensions);
ossu20a4b3f2017-04-27 02:08:52 -0700237 // Audio level indication
238 if (first_time || new_ids.audio_level != old_ids.audio_level) {
239 channel_proxy->SetSendAudioLevelIndicationStatus(new_ids.audio_level != 0,
240 new_ids.audio_level);
241 }
Sebastian Jansson8d9c5402017-11-15 17:22:16 +0100242 bool transport_seq_num_id_changed =
243 new_ids.transport_sequence_number != old_ids.transport_sequence_number;
Alex Narest867e5102018-06-12 13:40:18 +0200244 if (first_time ||
245 (transport_seq_num_id_changed &&
246 !webrtc::field_trial::IsEnabled("WebRTC-Audio-ForceNoTWCC"))) {
ossu1129df22017-06-30 01:38:56 -0700247 if (!first_time) {
ossu20a4b3f2017-04-27 02:08:52 -0700248 channel_proxy->ResetSenderCongestionControlObjects();
ossu20a4b3f2017-04-27 02:08:52 -0700249 }
250
Sebastian Jansson8d9c5402017-11-15 17:22:16 +0100251 RtcpBandwidthObserver* bandwidth_observer = nullptr;
Alex Narest867e5102018-06-12 13:40:18 +0200252 bool has_transport_sequence_number =
253 new_ids.transport_sequence_number != 0 &&
254 !webrtc::field_trial::IsEnabled("WebRTC-Audio-ForceNoTWCC");
Sebastian Jansson8d9c5402017-11-15 17:22:16 +0100255 if (has_transport_sequence_number) {
ossu20a4b3f2017-04-27 02:08:52 -0700256 channel_proxy->EnableSendTransportSequenceNumber(
257 new_ids.transport_sequence_number);
Sebastian Jansson8d9c5402017-11-15 17:22:16 +0100258 // Probing in application limited region is only used in combination with
259 // send side congestion control, wich depends on feedback packets which
260 // requires transport sequence numbers to be enabled.
Sebastian Janssone4be6da2018-02-15 16:51:41 +0100261 stream->transport_->EnablePeriodicAlrProbing(true);
262 bandwidth_observer = stream->transport_->GetBandwidthObserver();
ossu20a4b3f2017-04-27 02:08:52 -0700263 }
264
Sebastian Jansson8d9c5402017-11-15 17:22:16 +0100265 channel_proxy->RegisterSenderCongestionControlObjects(stream->transport_,
266 bandwidth_observer);
ossu20a4b3f2017-04-27 02:08:52 -0700267 }
268
Steve Antonbb50ce52018-03-26 10:24:32 -0700269 // MID RTP header extension.
Steve Anton003930a2018-03-29 12:37:21 -0700270 if ((first_time || new_ids.mid != old_ids.mid ||
271 new_config.rtp.mid != old_config.rtp.mid) &&
272 new_ids.mid != 0 && !new_config.rtp.mid.empty()) {
Steve Antonbb50ce52018-03-26 10:24:32 -0700273 channel_proxy->SetMid(new_config.rtp.mid, new_ids.mid);
274 }
275
ossu20a4b3f2017-04-27 02:08:52 -0700276 if (!ReconfigureSendCodec(stream, new_config)) {
Mirko Bonadei675513b2017-11-09 11:09:25 +0100277 RTC_LOG(LS_ERROR) << "Failed to set up send codec state.";
ossu20a4b3f2017-04-27 02:08:52 -0700278 }
279
Oskar Sundbomf85e31b2017-12-20 16:38:09 +0100280 if (stream->sending_) {
281 ReconfigureBitrateObserver(stream, new_config);
282 }
ossu20a4b3f2017-04-27 02:08:52 -0700283 stream->config_ = new_config;
284}
285
solenberg3a941542015-11-16 07:34:50 -0800286void AudioSendStream::Start() {
elad.alond12a8e12017-03-23 11:04:48 -0700287 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100288 if (sending_) {
289 return;
290 }
291
Sebastian Jansson763e9472018-03-21 12:46:56 +0100292 bool has_transport_sequence_number =
Alex Narest867e5102018-06-12 13:40:18 +0200293 FindExtensionIds(config_.rtp.extensions).transport_sequence_number != 0 &&
294 !webrtc::field_trial::IsEnabled("WebRTC-Audio-ForceNoTWCC");
Alex Narestcedd3512017-12-07 20:54:55 +0100295 if (config_.min_bitrate_bps != -1 && config_.max_bitrate_bps != -1 &&
Sebastian Jansson763e9472018-03-21 12:46:56 +0100296 (has_transport_sequence_number ||
Alex Narestcedd3512017-12-07 20:54:55 +0100297 !webrtc::field_trial::IsEnabled("WebRTC-Audio-SendSideBwe"))) {
Alex Narest78609d52017-10-20 10:37:47 +0200298 // Audio BWE is enabled.
299 transport_->packet_sender()->SetAccountForAudioPackets(true);
Seth Hampson24722b32017-12-22 09:36:42 -0800300 ConfigureBitrateObserver(config_.min_bitrate_bps, config_.max_bitrate_bps,
Sebastian Jansson763e9472018-03-21 12:46:56 +0100301 config_.bitrate_priority,
302 has_transport_sequence_number);
mflodman86cc6ff2016-07-26 04:44:06 -0700303 }
Fredrik Solenbergaaedf752017-12-18 13:09:12 +0100304 channel_proxy_->StartSend();
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100305 sending_ = true;
306 audio_state()->AddSendingStream(this, encoder_sample_rate_hz_,
307 encoder_num_channels_);
solenberg3a941542015-11-16 07:34:50 -0800308}
309
310void AudioSendStream::Stop() {
elad.alond12a8e12017-03-23 11:04:48 -0700311 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100312 if (!sending_) {
313 return;
314 }
315
ossu20a4b3f2017-04-27 02:08:52 -0700316 RemoveBitrateObserver();
Fredrik Solenbergaaedf752017-12-18 13:09:12 +0100317 channel_proxy_->StopSend();
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100318 sending_ = false;
319 audio_state()->RemoveSendingStream(this);
320}
321
322void AudioSendStream::SendAudioData(std::unique_ptr<AudioFrame> audio_frame) {
323 RTC_CHECK_RUNS_SERIALIZED(&audio_capture_race_checker_);
324 channel_proxy_->ProcessAndEncodeAudio(std::move(audio_frame));
solenberg3a941542015-11-16 07:34:50 -0800325}
326
solenbergffbbcac2016-11-17 05:25:37 -0800327bool AudioSendStream::SendTelephoneEvent(int payload_type,
Yves Gerey665174f2018-06-19 15:03:05 +0200328 int payload_frequency,
329 int event,
solenberg8842c3e2016-03-11 03:06:41 -0800330 int duration_ms) {
elad.alond12a8e12017-03-23 11:04:48 -0700331 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenbergffbbcac2016-11-17 05:25:37 -0800332 return channel_proxy_->SetSendTelephoneEventPayloadType(payload_type,
333 payload_frequency) &&
Fredrik Solenbergb5727682015-12-04 15:22:19 +0100334 channel_proxy_->SendTelephoneEventOutband(event, duration_ms);
335}
336
solenberg94218532016-06-16 10:53:22 -0700337void AudioSendStream::SetMuted(bool muted) {
elad.alond12a8e12017-03-23 11:04:48 -0700338 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg94218532016-06-16 10:53:22 -0700339 channel_proxy_->SetInputMute(muted);
340}
341
solenbergc7a8b082015-10-16 14:35:07 -0700342webrtc::AudioSendStream::Stats AudioSendStream::GetStats() const {
Ivo Creusen56d46092017-11-24 17:29:59 +0100343 return GetStats(true);
344}
345
346webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
347 bool has_remote_tracks) const {
elad.alond12a8e12017-03-23 11:04:48 -0700348 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
solenberg85a04962015-10-27 03:35:21 -0700349 webrtc::AudioSendStream::Stats stats;
350 stats.local_ssrc = config_.rtp.ssrc;
solenberg85a04962015-10-27 03:35:21 -0700351
solenberg358057b2015-11-27 10:46:42 -0800352 webrtc::CallStatistics call_stats = channel_proxy_->GetRTCPStatistics();
solenberg85a04962015-10-27 03:35:21 -0700353 stats.bytes_sent = call_stats.bytesSent;
354 stats.packets_sent = call_stats.packetsSent;
solenberg8b85de22015-11-16 09:48:04 -0800355 // RTT isn't known until a RTCP report is received. Until then, VoiceEngine
356 // returns 0 to indicate an error value.
357 if (call_stats.rttMs > 0) {
358 stats.rtt_ms = call_stats.rttMs;
359 }
ossu20a4b3f2017-04-27 02:08:52 -0700360 if (config_.send_codec_spec) {
361 const auto& spec = *config_.send_codec_spec;
362 stats.codec_name = spec.format.name;
Oskar Sundbom2707fb22017-11-16 10:57:35 +0100363 stats.codec_payload_type = spec.payload_type;
solenberg85a04962015-10-27 03:35:21 -0700364
365 // Get data from the last remote RTCP report.
solenberg358057b2015-11-27 10:46:42 -0800366 for (const auto& block : channel_proxy_->GetRemoteRTCPReportBlocks()) {
solenberg8b85de22015-11-16 09:48:04 -0800367 // Lookup report for send ssrc only.
368 if (block.source_SSRC == stats.local_ssrc) {
369 stats.packets_lost = block.cumulative_num_packets_lost;
370 stats.fraction_lost = Q8ToFloat(block.fraction_lost);
371 stats.ext_seqnum = block.extended_highest_sequence_number;
ossu20a4b3f2017-04-27 02:08:52 -0700372 // Convert timestamps to milliseconds.
373 if (spec.format.clockrate_hz / 1000 > 0) {
solenberg8b85de22015-11-16 09:48:04 -0800374 stats.jitter_ms =
ossu20a4b3f2017-04-27 02:08:52 -0700375 block.interarrival_jitter / (spec.format.clockrate_hz / 1000);
solenberg85a04962015-10-27 03:35:21 -0700376 }
solenberg8b85de22015-11-16 09:48:04 -0800377 break;
solenberg85a04962015-10-27 03:35:21 -0700378 }
379 }
380 }
381
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100382 AudioState::Stats input_stats = audio_state()->GetAudioInputStats();
383 stats.audio_level = input_stats.audio_level;
384 stats.total_input_energy = input_stats.total_energy;
385 stats.total_input_duration = input_stats.total_duration;
solenberg796b8f92017-03-01 17:02:23 -0800386
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100387 stats.typing_noise_detected = audio_state()->typing_noise_detected();
ivoce1198e02017-09-08 08:13:19 -0700388 stats.ana_statistics = channel_proxy_->GetANAStatistics();
Ivo Creusen56d46092017-11-24 17:29:59 +0100389 RTC_DCHECK(audio_state_->audio_processing());
390 stats.apm_statistics =
391 audio_state_->audio_processing()->GetStatistics(has_remote_tracks);
solenberg85a04962015-10-27 03:35:21 -0700392
393 return stats;
394}
395
pbos1ba8d392016-05-01 20:18:34 -0700396void AudioSendStream::SignalNetworkState(NetworkState state) {
elad.alond12a8e12017-03-23 11:04:48 -0700397 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
pbos1ba8d392016-05-01 20:18:34 -0700398}
399
400bool AudioSendStream::DeliverRtcp(const uint8_t* packet, size_t length) {
401 // TODO(solenberg): Tests call this function on a network thread, libjingle
402 // calls on the worker thread. We should move towards always using a network
403 // thread. Then this check can be enabled.
elad.alond12a8e12017-03-23 11:04:48 -0700404 // RTC_DCHECK(!worker_thread_checker_.CalledOnValidThread());
pbos1ba8d392016-05-01 20:18:34 -0700405 return channel_proxy_->ReceivedRTCPPacket(packet, length);
406}
407
mflodman86cc6ff2016-07-26 04:44:06 -0700408uint32_t AudioSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
409 uint8_t fraction_loss,
minyue78b4d562016-11-30 04:47:39 -0800410 int64_t rtt,
minyue93e45222017-05-18 14:32:41 -0700411 int64_t bwe_period_ms) {
stefanfca900a2017-04-10 03:53:00 -0700412 // A send stream may be allocated a bitrate of zero if the allocator decides
413 // to disable it. For now we ignore this decision and keep sending on min
414 // bitrate.
415 if (bitrate_bps == 0) {
416 bitrate_bps = config_.min_bitrate_bps;
417 }
Yves Gerey665174f2018-06-19 15:03:05 +0200418 RTC_DCHECK_GE(bitrate_bps, static_cast<uint32_t>(config_.min_bitrate_bps));
mflodman86cc6ff2016-07-26 04:44:06 -0700419 // The bitrate allocator might allocate an higher than max configured bitrate
420 // if there is room, to allow for, as example, extra FEC. Ignore that for now.
minyue10cbb462016-11-07 09:29:22 -0800421 const uint32_t max_bitrate_bps = config_.max_bitrate_bps;
mflodman86cc6ff2016-07-26 04:44:06 -0700422 if (bitrate_bps > max_bitrate_bps)
423 bitrate_bps = max_bitrate_bps;
424
minyue93e45222017-05-18 14:32:41 -0700425 channel_proxy_->SetBitrate(bitrate_bps, bwe_period_ms);
mflodman86cc6ff2016-07-26 04:44:06 -0700426
427 // The amount of audio protection is not exposed by the encoder, hence
428 // always returning 0.
429 return 0;
430}
431
elad.alond12a8e12017-03-23 11:04:48 -0700432void AudioSendStream::OnPacketAdded(uint32_t ssrc, uint16_t seq_num) {
433 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread());
434 // Only packets that belong to this stream are of interest.
435 if (ssrc == config_.rtp.ssrc) {
436 rtc::CritScope lock(&packet_loss_tracker_cs_);
eladalonedd6eea2017-05-25 00:15:35 -0700437 // TODO(eladalon): This function call could potentially reset the window,
elad.alond12a8e12017-03-23 11:04:48 -0700438 // setting both PLR and RPLR to unknown. Consider (during upcoming
439 // refactoring) passing an indication of such an event.
440 packet_loss_tracker_.OnPacketAdded(seq_num, rtc::TimeMillis());
441 }
442}
443
444void AudioSendStream::OnPacketFeedbackVector(
445 const std::vector<PacketFeedback>& packet_feedback_vector) {
eladalon3651fdd2017-08-24 07:26:25 -0700446 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
Danil Chapovalovb9b146c2018-06-15 12:28:07 +0200447 absl::optional<float> plr;
448 absl::optional<float> rplr;
elad.alond12a8e12017-03-23 11:04:48 -0700449 {
450 rtc::CritScope lock(&packet_loss_tracker_cs_);
451 packet_loss_tracker_.OnPacketFeedbackVector(packet_feedback_vector);
452 plr = packet_loss_tracker_.GetPacketLossRate();
elad.alondadb4dc2017-03-23 15:29:50 -0700453 rplr = packet_loss_tracker_.GetRecoverablePacketLossRate();
elad.alond12a8e12017-03-23 11:04:48 -0700454 }
eladalonedd6eea2017-05-25 00:15:35 -0700455 // TODO(eladalon): If R/PLR go back to unknown, no indication is given that
elad.alond12a8e12017-03-23 11:04:48 -0700456 // the previously sent value is no longer relevant. This will be taken care
457 // of with some refactoring which is now being done.
458 if (plr) {
459 channel_proxy_->OnTwccBasedUplinkPacketLossRate(*plr);
460 }
elad.alondadb4dc2017-03-23 15:29:50 -0700461 if (rplr) {
462 channel_proxy_->OnRecoverableUplinkPacketLossRate(*rplr);
463 }
elad.alond12a8e12017-03-23 11:04:48 -0700464}
465
michaelt79e05882016-11-08 02:50:09 -0800466void AudioSendStream::SetTransportOverhead(int transport_overhead_per_packet) {
elad.alond12a8e12017-03-23 11:04:48 -0700467 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
michaelt79e05882016-11-08 02:50:09 -0800468 channel_proxy_->SetTransportOverhead(transport_overhead_per_packet);
469}
470
ossuc3d4b482017-05-23 06:07:11 -0700471RtpState AudioSendStream::GetRtpState() const {
472 return rtp_rtcp_module_->GetRtpState();
473}
474
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +0100475const voe::ChannelProxy& AudioSendStream::GetChannelProxy() const {
476 RTC_DCHECK(channel_proxy_.get());
477 return *channel_proxy_.get();
478}
479
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100480internal::AudioState* AudioSendStream::audio_state() {
481 internal::AudioState* audio_state =
482 static_cast<internal::AudioState*>(audio_state_.get());
483 RTC_DCHECK(audio_state);
484 return audio_state;
485}
486
487const internal::AudioState* AudioSendStream::audio_state() const {
488 internal::AudioState* audio_state =
489 static_cast<internal::AudioState*>(audio_state_.get());
490 RTC_DCHECK(audio_state);
491 return audio_state;
492}
493
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100494void AudioSendStream::StoreEncoderProperties(int sample_rate_hz,
495 size_t num_channels) {
496 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
497 encoder_sample_rate_hz_ = sample_rate_hz;
498 encoder_num_channels_ = num_channels;
499 if (sending_) {
500 // Update AudioState's information about the stream.
501 audio_state()->AddSendingStream(this, sample_rate_hz, num_channels);
502 }
503}
504
minyue7a973442016-10-20 03:27:12 -0700505// Apply current codec settings to a single voe::Channel used for sending.
ossu20a4b3f2017-04-27 02:08:52 -0700506bool AudioSendStream::SetupSendCodec(AudioSendStream* stream,
507 const Config& new_config) {
508 RTC_DCHECK(new_config.send_codec_spec);
509 const auto& spec = *new_config.send_codec_spec;
minyue48368ad2017-05-10 04:06:11 -0700510
511 RTC_DCHECK(new_config.encoder_factory);
ossu20a4b3f2017-04-27 02:08:52 -0700512 std::unique_ptr<AudioEncoder> encoder =
Karl Wiberg77490b92018-03-21 15:18:42 +0100513 new_config.encoder_factory->MakeAudioEncoder(
514 spec.payload_type, spec.format, new_config.codec_pair_id);
minyue7a973442016-10-20 03:27:12 -0700515
ossu20a4b3f2017-04-27 02:08:52 -0700516 if (!encoder) {
Jonas Olssonabbe8412018-04-03 13:40:05 +0200517 RTC_DLOG(LS_ERROR) << "Unable to create encoder for "
518 << rtc::ToString(spec.format);
ossu20a4b3f2017-04-27 02:08:52 -0700519 return false;
520 }
521 // If a bitrate has been specified for the codec, use it over the
522 // codec's default.
523 if (spec.target_bitrate_bps) {
524 encoder->OnReceivedTargetAudioBitrate(*spec.target_bitrate_bps);
minyue7a973442016-10-20 03:27:12 -0700525 }
526
ossu20a4b3f2017-04-27 02:08:52 -0700527 // Enable ANA if configured (currently only used by Opus).
528 if (new_config.audio_network_adaptor_config) {
529 if (encoder->EnableAudioNetworkAdaptor(
530 *new_config.audio_network_adaptor_config, stream->event_log_)) {
Jonas Olsson24ea8222018-01-25 10:14:29 +0100531 RTC_DLOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
532 << new_config.rtp.ssrc;
ossu20a4b3f2017-04-27 02:08:52 -0700533 } else {
534 RTC_NOTREACHED();
minyue6b825df2016-10-31 04:08:32 -0700535 }
minyue7a973442016-10-20 03:27:12 -0700536 }
537
ossu20a4b3f2017-04-27 02:08:52 -0700538 // Wrap the encoder in a an AudioEncoderCNG, if VAD is enabled.
539 if (spec.cng_payload_type) {
540 AudioEncoderCng::Config cng_config;
541 cng_config.num_channels = encoder->NumChannels();
542 cng_config.payload_type = *spec.cng_payload_type;
543 cng_config.speech_encoder = std::move(encoder);
544 cng_config.vad_mode = Vad::kVadNormal;
545 encoder.reset(new AudioEncoderCng(std::move(cng_config)));
ossu3b9ff382017-04-27 08:03:42 -0700546
547 stream->RegisterCngPayloadType(
548 *spec.cng_payload_type,
549 new_config.send_codec_spec->format.clockrate_hz);
minyue7a973442016-10-20 03:27:12 -0700550 }
ossu20a4b3f2017-04-27 02:08:52 -0700551
Fredrik Solenberg2a877972017-12-15 16:42:15 +0100552 stream->StoreEncoderProperties(encoder->SampleRateHz(),
553 encoder->NumChannels());
ossu20a4b3f2017-04-27 02:08:52 -0700554 stream->channel_proxy_->SetEncoder(new_config.send_codec_spec->payload_type,
555 std::move(encoder));
minyue7a973442016-10-20 03:27:12 -0700556 return true;
557}
558
ossu20a4b3f2017-04-27 02:08:52 -0700559bool AudioSendStream::ReconfigureSendCodec(AudioSendStream* stream,
560 const Config& new_config) {
561 const auto& old_config = stream->config_;
minyue-webrtc8de18262017-07-26 14:18:40 +0200562
563 if (!new_config.send_codec_spec) {
564 // We cannot de-configure a send codec. So we will do nothing.
565 // By design, the send codec should have not been configured.
566 RTC_DCHECK(!old_config.send_codec_spec);
567 return true;
568 }
569
570 if (new_config.send_codec_spec == old_config.send_codec_spec &&
571 new_config.audio_network_adaptor_config ==
572 old_config.audio_network_adaptor_config) {
ossu20a4b3f2017-04-27 02:08:52 -0700573 return true;
574 }
575
576 // If we have no encoder, or the format or payload type's changed, create a
577 // new encoder.
578 if (!old_config.send_codec_spec ||
579 new_config.send_codec_spec->format !=
580 old_config.send_codec_spec->format ||
581 new_config.send_codec_spec->payload_type !=
582 old_config.send_codec_spec->payload_type) {
583 return SetupSendCodec(stream, new_config);
584 }
585
Danil Chapovalovb9b146c2018-06-15 12:28:07 +0200586 const absl::optional<int>& new_target_bitrate_bps =
ossu20a4b3f2017-04-27 02:08:52 -0700587 new_config.send_codec_spec->target_bitrate_bps;
588 // If a bitrate has been specified for the codec, use it over the
589 // codec's default.
590 if (new_target_bitrate_bps &&
591 new_target_bitrate_bps !=
592 old_config.send_codec_spec->target_bitrate_bps) {
593 CallEncoder(stream->channel_proxy_, [&](AudioEncoder* encoder) {
594 encoder->OnReceivedTargetAudioBitrate(*new_target_bitrate_bps);
595 });
596 }
597
598 ReconfigureANA(stream, new_config);
599 ReconfigureCNG(stream, new_config);
600
601 return true;
602}
603
604void AudioSendStream::ReconfigureANA(AudioSendStream* stream,
605 const Config& new_config) {
606 if (new_config.audio_network_adaptor_config ==
607 stream->config_.audio_network_adaptor_config) {
608 return;
609 }
610 if (new_config.audio_network_adaptor_config) {
611 CallEncoder(stream->channel_proxy_, [&](AudioEncoder* encoder) {
612 if (encoder->EnableAudioNetworkAdaptor(
613 *new_config.audio_network_adaptor_config, stream->event_log_)) {
Jonas Olsson24ea8222018-01-25 10:14:29 +0100614 RTC_DLOG(LS_INFO) << "Audio network adaptor enabled on SSRC "
615 << new_config.rtp.ssrc;
ossu20a4b3f2017-04-27 02:08:52 -0700616 } else {
617 RTC_NOTREACHED();
618 }
619 });
620 } else {
621 CallEncoder(stream->channel_proxy_, [&](AudioEncoder* encoder) {
622 encoder->DisableAudioNetworkAdaptor();
623 });
Jonas Olsson24ea8222018-01-25 10:14:29 +0100624 RTC_DLOG(LS_INFO) << "Audio network adaptor disabled on SSRC "
625 << new_config.rtp.ssrc;
ossu20a4b3f2017-04-27 02:08:52 -0700626 }
627}
628
629void AudioSendStream::ReconfigureCNG(AudioSendStream* stream,
630 const Config& new_config) {
631 if (new_config.send_codec_spec->cng_payload_type ==
632 stream->config_.send_codec_spec->cng_payload_type) {
633 return;
634 }
635
ossu3b9ff382017-04-27 08:03:42 -0700636 // Register the CNG payload type if it's been added, don't do anything if CNG
637 // is removed. Payload types must not be redefined.
638 if (new_config.send_codec_spec->cng_payload_type) {
639 stream->RegisterCngPayloadType(
640 *new_config.send_codec_spec->cng_payload_type,
641 new_config.send_codec_spec->format.clockrate_hz);
642 }
643
ossu20a4b3f2017-04-27 02:08:52 -0700644 // Wrap or unwrap the encoder in an AudioEncoderCNG.
645 stream->channel_proxy_->ModifyEncoder(
646 [&](std::unique_ptr<AudioEncoder>* encoder_ptr) {
647 std::unique_ptr<AudioEncoder> old_encoder(std::move(*encoder_ptr));
648 auto sub_encoders = old_encoder->ReclaimContainedEncoders();
649 if (!sub_encoders.empty()) {
650 // Replace enc with its sub encoder. We need to put the sub
651 // encoder in a temporary first, since otherwise the old value
652 // of enc would be destroyed before the new value got assigned,
653 // which would be bad since the new value is a part of the old
654 // value.
655 auto tmp = std::move(sub_encoders[0]);
656 old_encoder = std::move(tmp);
657 }
658 if (new_config.send_codec_spec->cng_payload_type) {
659 AudioEncoderCng::Config config;
660 config.speech_encoder = std::move(old_encoder);
661 config.num_channels = config.speech_encoder->NumChannels();
662 config.payload_type = *new_config.send_codec_spec->cng_payload_type;
663 config.vad_mode = Vad::kVadNormal;
664 encoder_ptr->reset(new AudioEncoderCng(std::move(config)));
665 } else {
666 *encoder_ptr = std::move(old_encoder);
667 }
668 });
669}
670
671void AudioSendStream::ReconfigureBitrateObserver(
672 AudioSendStream* stream,
673 const webrtc::AudioSendStream::Config& new_config) {
674 // Since the Config's default is for both of these to be -1, this test will
675 // allow us to configure the bitrate observer if the new config has bitrate
676 // limits set, but would only have us call RemoveBitrateObserver if we were
677 // previously configured with bitrate limits.
Alex Narestcedd3512017-12-07 20:54:55 +0100678 int new_transport_seq_num_id =
679 FindExtensionIds(new_config.rtp.extensions).transport_sequence_number;
ossu20a4b3f2017-04-27 02:08:52 -0700680 if (stream->config_.min_bitrate_bps == new_config.min_bitrate_bps &&
Alex Narestcedd3512017-12-07 20:54:55 +0100681 stream->config_.max_bitrate_bps == new_config.max_bitrate_bps &&
Seth Hampson24722b32017-12-22 09:36:42 -0800682 stream->config_.bitrate_priority == new_config.bitrate_priority &&
Alex Narestcedd3512017-12-07 20:54:55 +0100683 (FindExtensionIds(stream->config_.rtp.extensions)
684 .transport_sequence_number == new_transport_seq_num_id ||
685 !webrtc::field_trial::IsEnabled("WebRTC-Audio-SendSideBwe"))) {
ossu20a4b3f2017-04-27 02:08:52 -0700686 return;
687 }
688
Sebastian Jansson763e9472018-03-21 12:46:56 +0100689 bool has_transport_sequence_number = new_transport_seq_num_id != 0;
Alex Narestcedd3512017-12-07 20:54:55 +0100690 if (new_config.min_bitrate_bps != -1 && new_config.max_bitrate_bps != -1 &&
Sebastian Jansson763e9472018-03-21 12:46:56 +0100691 (has_transport_sequence_number ||
Alex Narestcedd3512017-12-07 20:54:55 +0100692 !webrtc::field_trial::IsEnabled("WebRTC-Audio-SendSideBwe"))) {
Sebastian Jansson763e9472018-03-21 12:46:56 +0100693 stream->ConfigureBitrateObserver(
694 new_config.min_bitrate_bps, new_config.max_bitrate_bps,
695 new_config.bitrate_priority, has_transport_sequence_number);
ossu20a4b3f2017-04-27 02:08:52 -0700696 } else {
697 stream->RemoveBitrateObserver();
698 }
699}
700
701void AudioSendStream::ConfigureBitrateObserver(int min_bitrate_bps,
Seth Hampson24722b32017-12-22 09:36:42 -0800702 int max_bitrate_bps,
Sebastian Jansson763e9472018-03-21 12:46:56 +0100703 double bitrate_priority,
704 bool has_packet_feedback) {
ossu20a4b3f2017-04-27 02:08:52 -0700705 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
706 RTC_DCHECK_GE(max_bitrate_bps, min_bitrate_bps);
707 rtc::Event thread_sync_event(false /* manual_reset */, false);
708 worker_queue_->PostTask([&] {
709 // We may get a callback immediately as the observer is registered, so make
710 // sure the bitrate limits in config_ are up-to-date.
711 config_.min_bitrate_bps = min_bitrate_bps;
712 config_.max_bitrate_bps = max_bitrate_bps;
Seth Hampson24722b32017-12-22 09:36:42 -0800713 config_.bitrate_priority = bitrate_priority;
714 // This either updates the current observer or adds a new observer.
Sebastian Jansson24ad7202018-04-19 08:25:12 +0200715 bitrate_allocator_->AddObserver(
716 this, MediaStreamAllocationConfig{
717 static_cast<uint32_t>(min_bitrate_bps),
718 static_cast<uint32_t>(max_bitrate_bps), 0, true,
719 config_.track_id, bitrate_priority, has_packet_feedback});
ossu20a4b3f2017-04-27 02:08:52 -0700720 thread_sync_event.Set();
721 });
722 thread_sync_event.Wait(rtc::Event::kForever);
723}
724
725void AudioSendStream::RemoveBitrateObserver() {
726 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
727 rtc::Event thread_sync_event(false /* manual_reset */, false);
728 worker_queue_->PostTask([this, &thread_sync_event] {
729 bitrate_allocator_->RemoveObserver(this);
730 thread_sync_event.Set();
731 });
732 thread_sync_event.Wait(rtc::Event::kForever);
733}
734
ossu3b9ff382017-04-27 08:03:42 -0700735void AudioSendStream::RegisterCngPayloadType(int payload_type,
736 int clockrate_hz) {
ossu3b9ff382017-04-27 08:03:42 -0700737 const CodecInst codec = {payload_type, "CN", clockrate_hz, 0, 1, 0};
ossuc3d4b482017-05-23 06:07:11 -0700738 if (rtp_rtcp_module_->RegisterSendPayload(codec) != 0) {
739 rtp_rtcp_module_->DeRegisterSendPayload(codec.pltype);
740 if (rtp_rtcp_module_->RegisterSendPayload(codec) != 0) {
Jonas Olsson24ea8222018-01-25 10:14:29 +0100741 RTC_DLOG(LS_ERROR) << "RegisterCngPayloadType() failed to register CN to "
742 "RTP/RTCP module";
ossu3b9ff382017-04-27 08:03:42 -0700743 }
744 }
745}
solenbergc7a8b082015-10-16 14:35:07 -0700746} // namespace internal
747} // namespace webrtc