Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: webrtc/audio/audio_send_stream.cc

Issue 2247213005: Fixing config for Audio BWE. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebasing Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 AudioSendStream::~AudioSendStream() { 93 AudioSendStream::~AudioSendStream() {
94 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 94 RTC_DCHECK(thread_checker_.CalledOnValidThread());
95 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); 95 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString();
96 channel_proxy_->DeRegisterExternalTransport(); 96 channel_proxy_->DeRegisterExternalTransport();
97 channel_proxy_->ResetCongestionControlObjects(); 97 channel_proxy_->ResetCongestionControlObjects();
98 channel_proxy_->SetRtcEventLog(nullptr); 98 channel_proxy_->SetRtcEventLog(nullptr);
99 } 99 }
100 100
101 void AudioSendStream::Start() { 101 void AudioSendStream::Start() {
102 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 102 RTC_DCHECK(thread_checker_.CalledOnValidThread());
103 if (config_.min_bitrate_kbps != -1 && config_.max_bitrate_kbps != -1) { 103 if (config_.min_bitrate_bps != -1 && config_.max_bitrate_bps != -1) {
104 RTC_DCHECK_GE(config_.max_bitrate_kbps, config_.min_bitrate_kbps); 104 RTC_DCHECK_GE(config_.max_bitrate_bps, config_.min_bitrate_bps);
105 rtc::Event thread_sync_event(false /* manual_reset */, false); 105 rtc::Event thread_sync_event(false /* manual_reset */, false);
106 worker_queue_->PostTask([this, &thread_sync_event] { 106 worker_queue_->PostTask([this, &thread_sync_event] {
107 bitrate_allocator_->AddObserver(this, config_.min_bitrate_kbps * 1000, 107 bitrate_allocator_->AddObserver(this, config_.min_bitrate_bps,
108 config_.max_bitrate_kbps * 1000, 0, true); 108 config_.max_bitrate_bps, 0, true);
109 thread_sync_event.Set(); 109 thread_sync_event.Set();
110 }); 110 });
111 thread_sync_event.Wait(rtc::Event::kForever); 111 thread_sync_event.Wait(rtc::Event::kForever);
112 } 112 }
113 113
114 ScopedVoEInterface<VoEBase> base(voice_engine()); 114 ScopedVoEInterface<VoEBase> base(voice_engine());
115 int error = base->StartSend(config_.voe_channel_id); 115 int error = base->StartSend(config_.voe_channel_id);
116 if (error != 0) { 116 if (error != 0) {
117 LOG(LS_ERROR) << "AudioSendStream::Start failed with error: " << error; 117 LOG(LS_ERROR) << "AudioSendStream::Start failed with error: " << error;
118 } 118 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // calls on the worker thread. We should move towards always using a network 241 // calls on the worker thread. We should move towards always using a network
242 // thread. Then this check can be enabled. 242 // thread. Then this check can be enabled.
243 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); 243 // RTC_DCHECK(!thread_checker_.CalledOnValidThread());
244 return channel_proxy_->ReceivedRTCPPacket(packet, length); 244 return channel_proxy_->ReceivedRTCPPacket(packet, length);
245 } 245 }
246 246
247 uint32_t AudioSendStream::OnBitrateUpdated(uint32_t bitrate_bps, 247 uint32_t AudioSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
248 uint8_t fraction_loss, 248 uint8_t fraction_loss,
249 int64_t rtt) { 249 int64_t rtt) {
250 RTC_DCHECK_GE(bitrate_bps, 250 RTC_DCHECK_GE(bitrate_bps,
251 static_cast<uint32_t>(config_.min_bitrate_kbps * 1000)); 251 static_cast<uint32_t>(config_.min_bitrate_bps));
252 // The bitrate allocator might allocate an higher than max configured bitrate 252 // The bitrate allocator might allocate an higher than max configured bitrate
253 // if there is room, to allow for, as example, extra FEC. Ignore that for now. 253 // if there is room, to allow for, as example, extra FEC. Ignore that for now.
254 const uint32_t max_bitrate_bps = config_.max_bitrate_kbps * 1000; 254 const uint32_t max_bitrate_bps = config_.max_bitrate_bps;
255 if (bitrate_bps > max_bitrate_bps) 255 if (bitrate_bps > max_bitrate_bps)
256 bitrate_bps = max_bitrate_bps; 256 bitrate_bps = max_bitrate_bps;
257 257
258 channel_proxy_->SetBitrate(bitrate_bps); 258 channel_proxy_->SetBitrate(bitrate_bps);
259 259
260 // The amount of audio protection is not exposed by the encoder, hence 260 // The amount of audio protection is not exposed by the encoder, hence
261 // always returning 0. 261 // always returning 0.
262 return 0; 262 return 0;
263 } 263 }
264 264
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError(); 371 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError();
372 return false; 372 return false;
373 } 373 }
374 } 374 }
375 } 375 }
376 return true; 376 return true;
377 } 377 }
378 378
379 } // namespace internal 379 } // namespace internal
380 } // namespace webrtc 380 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698