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

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

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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Otherwise, returns the current complexity depending on whether the 49 // Otherwise, returns the current complexity depending on whether the
50 // current bitrate is above or below complexity_threshold_bps. 50 // current bitrate is above or below complexity_threshold_bps.
51 rtc::Optional<int> GetNewComplexity() const; 51 rtc::Optional<int> GetNewComplexity() const;
52 52
53 int frame_size_ms = 20; 53 int frame_size_ms = 20;
54 size_t num_channels = 1; 54 size_t num_channels = 1;
55 int payload_type = 120; 55 int payload_type = 120;
56 ApplicationMode application = kVoip; 56 ApplicationMode application = kVoip;
57 rtc::Optional<int> bitrate_bps; // Unset means to use default value. 57 rtc::Optional<int> bitrate_bps; // Unset means to use default value.
58 bool fec_enabled = false; 58 bool fec_enabled = false;
59 bool cbr_enabled = false;
59 int max_playback_rate_hz = 48000; 60 int max_playback_rate_hz = 48000;
60 int complexity = kDefaultComplexity; 61 int complexity = kDefaultComplexity;
61 // This value may change in the struct's constructor. 62 // This value may change in the struct's constructor.
62 int low_rate_complexity = kDefaultComplexity; 63 int low_rate_complexity = kDefaultComplexity;
63 // low_rate_complexity is used when the bitrate is below this threshold. 64 // low_rate_complexity is used when the bitrate is below this threshold.
64 int complexity_threshold_bps = 12500; 65 int complexity_threshold_bps = 12500;
65 int complexity_threshold_window_bps = 1500; 66 int complexity_threshold_window_bps = 1500;
66 bool dtx_enabled = false; 67 bool dtx_enabled = false;
67 std::vector<int> supported_frame_lengths_ms; 68 std::vector<int> supported_frame_lengths_ms;
68 const Clock* clock = Clock::GetRealTimeClock(); 69 const Clock* clock = Clock::GetRealTimeClock();
(...skipping 30 matching lines...) Expand all
99 100
100 void Reset() override; 101 void Reset() override;
101 bool SetFec(bool enable) override; 102 bool SetFec(bool enable) override;
102 103
103 // Set Opus DTX. Once enabled, Opus stops transmission, when it detects voice 104 // Set Opus DTX. Once enabled, Opus stops transmission, when it detects voice
104 // being inactive. During that, it still sends 2 packets (one for content, one 105 // being inactive. During that, it still sends 2 packets (one for content, one
105 // for signaling) about every 400 ms. 106 // for signaling) about every 400 ms.
106 bool SetDtx(bool enable) override; 107 bool SetDtx(bool enable) override;
107 bool GetDtx() const override; 108 bool GetDtx() const override;
108 109
110 // Set Opus CBR.
111 bool SetCbr(bool enable) override;
112 bool GetCbr() const override;
113
109 bool SetApplication(Application application) override; 114 bool SetApplication(Application application) override;
110 void SetMaxPlaybackRate(int frequency_hz) override; 115 void SetMaxPlaybackRate(int frequency_hz) override;
111 bool EnableAudioNetworkAdaptor(const std::string& config_string, 116 bool EnableAudioNetworkAdaptor(const std::string& config_string,
112 RtcEventLog* event_log, 117 RtcEventLog* event_log,
113 const Clock* clock) override; 118 const Clock* clock) override;
114 void DisableAudioNetworkAdaptor() override; 119 void DisableAudioNetworkAdaptor() override;
115 void OnReceivedUplinkPacketLossFraction( 120 void OnReceivedUplinkPacketLossFraction(
116 float uplink_packet_loss_fraction) override; 121 float uplink_packet_loss_fraction) override;
117 void OnReceivedUplinkBandwidth( 122 void OnReceivedUplinkBandwidth(
118 int target_audio_bitrate_bps, 123 int target_audio_bitrate_bps,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 rtc::Optional<size_t> overhead_bytes_per_packet_; 180 rtc::Optional<size_t> overhead_bytes_per_packet_;
176 const std::unique_ptr<SmoothingFilter> bitrate_smoother_; 181 const std::unique_ptr<SmoothingFilter> bitrate_smoother_;
177 rtc::Optional<int64_t> bitrate_smoother_last_update_time_; 182 rtc::Optional<int64_t> bitrate_smoother_last_update_time_;
178 183
179 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); 184 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus);
180 }; 185 };
181 186
182 } // namespace webrtc 187 } // namespace webrtc
183 188
184 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ 189 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698