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

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

Issue 2669733002: Add 120ms frame ability to ANA (Closed)
Patch Set: Respond to comments. Created 3 years, 10 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
« no previous file with comments | « webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
28 28
29 namespace { 29 namespace {
30 30
31 constexpr int kSampleRateHz = 48000; 31 constexpr int kSampleRateHz = 48000;
32 32
33 // Opus API allows a min bitrate of 500bps, but Opus documentation suggests 33 // Opus API allows a min bitrate of 500bps, but Opus documentation suggests
34 // a minimum bitrate of 6kbps. 34 // a minimum bitrate of 6kbps.
35 constexpr int kMinBitrateBps = 6000; 35 constexpr int kMinBitrateBps = 6000;
36 36
37 constexpr int kMaxBitrateBps = 512000; 37 constexpr int kMaxBitrateBps = 512000;
38
39 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME
40 constexpr int kSupportedFrameLengths[] = {20, 60, 120};
41 #else
38 constexpr int kSupportedFrameLengths[] = {20, 60}; 42 constexpr int kSupportedFrameLengths[] = {20, 60};
43 #endif
39 44
40 // PacketLossFractionSmoother uses an exponential filter with a time constant 45 // PacketLossFractionSmoother uses an exponential filter with a time constant
41 // of -1.0 / ln(0.9999) = 10000 ms. 46 // of -1.0 / ln(0.9999) = 10000 ms.
42 constexpr float kAlphaForPacketLossFractionSmoother = 0.9999f; 47 constexpr float kAlphaForPacketLossFractionSmoother = 0.9999f;
43 48
44 AudioEncoderOpus::Config CreateConfig(const CodecInst& codec_inst) { 49 AudioEncoderOpus::Config CreateConfig(const CodecInst& codec_inst) {
45 AudioEncoderOpus::Config config; 50 AudioEncoderOpus::Config config;
46 config.frame_size_ms = rtc::CheckedDivExact(codec_inst.pacsize, 48); 51 config.frame_size_ms = rtc::CheckedDivExact(codec_inst.pacsize, 48);
47 config.num_channels = codec_inst.channels; 52 config.num_channels = codec_inst.channels;
48 config.bitrate_bps = rtc::Optional<int>(codec_inst.rate); 53 config.bitrate_bps = rtc::Optional<int>(codec_inst.rate);
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 config_.uplink_bandwidth_update_interval_ms) { 560 config_.uplink_bandwidth_update_interval_ms) {
556 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage(); 561 rtc::Optional<float> smoothed_bitrate = bitrate_smoother_->GetAverage();
557 if (smoothed_bitrate) 562 if (smoothed_bitrate)
558 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate); 563 audio_network_adaptor_->SetUplinkBandwidth(*smoothed_bitrate);
559 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms); 564 bitrate_smoother_last_update_time_ = rtc::Optional<int64_t>(now_ms);
560 } 565 }
561 } 566 }
562 } 567 }
563 568
564 } // namespace webrtc 569 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/audio_network_adaptor/frame_length_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698