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

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc

Issue 2772773002: Adding cbr support for Opus (Closed)
Patch Set: Merge opus dtx and cbr testing. Other review comments adressed as well Created 3 years, 8 months 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_)); 253 RTC_CHECK_EQ(0, WebRtcOpus_DisableDtx(inst_));
254 } 254 }
255 config_.dtx_enabled = enable; 255 config_.dtx_enabled = enable;
256 return true; 256 return true;
257 } 257 }
258 258
259 bool AudioEncoderOpus::GetDtx() const { 259 bool AudioEncoderOpus::GetDtx() const {
260 return config_.dtx_enabled; 260 return config_.dtx_enabled;
261 } 261 }
262 262
263 bool AudioEncoderOpus::SetCbr(bool enable) {
264 if (enable) {
265 RTC_CHECK_EQ(0, WebRtcOpus_EnableCbr(inst_));
266 } else {
267 RTC_CHECK_EQ(0, WebRtcOpus_DisableCbr(inst_));
268 }
269 config_.cbr_enabled = enable;
270 return true;
271 }
272
273 bool AudioEncoderOpus::GetCbr() const {
274 return config_.cbr_enabled;
275 }
276
263 bool AudioEncoderOpus::SetApplication(Application application) { 277 bool AudioEncoderOpus::SetApplication(Application application) {
264 auto conf = config_; 278 auto conf = config_;
265 switch (application) { 279 switch (application) {
266 case Application::kSpeech: 280 case Application::kSpeech:
267 conf.application = AudioEncoderOpus::kVoip; 281 conf.application = AudioEncoderOpus::kVoip;
268 break; 282 break;
269 case Application::kAudio: 283 case Application::kAudio:
270 conf.application = AudioEncoderOpus::kAudio; 284 conf.application = AudioEncoderOpus::kAudio;
271 break; 285 break;
272 } 286 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 config_.uplink_bandwidth_update_interval_ms) { 575 config_.uplink_bandwidth_update_interval_ms) {
562 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); 576 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage();
563 if (smoothed_bitrate) 577 if (smoothed_bitrate)
564 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); 578 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate);
565 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); 579 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms);
566 } 580 }
567 } 581 }
568 } 582 }
569 583
570 } // namespace webrtc 584 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698