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

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

Issue 2537243004: Revert of Renaming AudioEncoder::SetTargetBitrate and SetProjectedPacketLossRate. (Closed)
Patch Set: Created 4 years 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool SetFec(bool enable) override; 95 bool SetFec(bool enable) override;
96 96
97 // Set Opus DTX. Once enabled, Opus stops transmission, when it detects voice 97 // Set Opus DTX. Once enabled, Opus stops transmission, when it detects voice
98 // being inactive. During that, it still sends 2 packets (one for content, one 98 // being inactive. During that, it still sends 2 packets (one for content, one
99 // for signaling) about every 400 ms. 99 // for signaling) about every 400 ms.
100 bool SetDtx(bool enable) override; 100 bool SetDtx(bool enable) override;
101 bool GetDtx() const override; 101 bool GetDtx() const override;
102 102
103 bool SetApplication(Application application) override; 103 bool SetApplication(Application application) override;
104 void SetMaxPlaybackRate(int frequency_hz) override; 104 void SetMaxPlaybackRate(int frequency_hz) override;
105 void SetProjectedPacketLossRate(double fraction) override;
106 void SetTargetBitrate(int target_bps) override;
107
105 bool EnableAudioNetworkAdaptor(const std::string& config_string, 108 bool EnableAudioNetworkAdaptor(const std::string& config_string,
106 const Clock* clock) override; 109 const Clock* clock) override;
107 void DisableAudioNetworkAdaptor() override; 110 void DisableAudioNetworkAdaptor() override;
108 void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps) override; 111 void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps) override;
109 void OnReceivedUplinkPacketLossFraction( 112 void OnReceivedUplinkPacketLossFraction(
110 float uplink_packet_loss_fraction) override; 113 float uplink_packet_loss_fraction) override;
111 void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) override; 114 void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) override;
112 void OnReceivedRtt(int rtt_ms) override; 115 void OnReceivedRtt(int rtt_ms) override;
113 void SetReceiverFrameLengthRange(int min_frame_length_ms, 116 void SetReceiverFrameLengthRange(int min_frame_length_ms,
114 int max_frame_length_ms) override; 117 int max_frame_length_ms) override;
115 rtc::ArrayView<const int> supported_frame_lengths_ms() const { 118 rtc::ArrayView<const int> supported_frame_lengths_ms() const {
116 return config_.supported_frame_lengths_ms; 119 return config_.supported_frame_lengths_ms;
117 } 120 }
118 121
119 // Getters for testing. 122 // Getters for testing.
120 float packet_loss_rate() const { return packet_loss_rate_; } 123 double packet_loss_rate() const { return packet_loss_rate_; }
121 ApplicationMode application() const { return config_.application; } 124 ApplicationMode application() const { return config_.application; }
122 bool fec_enabled() const { return config_.fec_enabled; } 125 bool fec_enabled() const { return config_.fec_enabled; }
123 size_t num_channels_to_encode() const { return num_channels_to_encode_; } 126 size_t num_channels_to_encode() const { return num_channels_to_encode_; }
124 int next_frame_length_ms() const { return next_frame_length_ms_; } 127 int next_frame_length_ms() const { return next_frame_length_ms_; }
125 128
126 protected: 129 protected:
127 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, 130 EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
128 rtc::ArrayView<const int16_t> audio, 131 rtc::ArrayView<const int16_t> audio,
129 rtc::Buffer* encoded) override; 132 rtc::Buffer* encoded) override;
130 133
131 private: 134 private:
132 class PacketLossFractionSmoother; 135 class PacketLossFractionSmoother;
133 136
134 size_t Num10msFramesPerPacket() const; 137 size_t Num10msFramesPerPacket() const;
135 size_t SamplesPer10msFrame() const; 138 size_t SamplesPer10msFrame() const;
136 size_t SufficientOutputBufferSize() const; 139 size_t SufficientOutputBufferSize() const;
137 bool RecreateEncoderInstance(const Config& config); 140 bool RecreateEncoderInstance(const Config& config);
138 void SetFrameLength(int frame_length_ms); 141 void SetFrameLength(int frame_length_ms);
139 void SetNumChannelsToEncode(size_t num_channels_to_encode); 142 void SetNumChannelsToEncode(size_t num_channels_to_encode);
140 void SetProjectedPacketLossRate(float fraction);
141 void SetTargetBitrate(int target_bps);
142 void ApplyAudioNetworkAdaptor(); 143 void ApplyAudioNetworkAdaptor();
143 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator( 144 std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator(
144 const std::string& config_string, 145 const std::string& config_string,
145 const Clock* clock) const; 146 const Clock* clock) const;
146 147
147 Config config_; 148 Config config_;
148 float packet_loss_rate_; 149 double packet_loss_rate_;
149 std::vector<int16_t> input_buffer_; 150 std::vector<int16_t> input_buffer_;
150 OpusEncInst* inst_; 151 OpusEncInst* inst_;
151 uint32_t first_timestamp_in_buffer_; 152 uint32_t first_timestamp_in_buffer_;
152 size_t num_channels_to_encode_; 153 size_t num_channels_to_encode_;
153 int next_frame_length_ms_; 154 int next_frame_length_ms_;
154 int complexity_; 155 int complexity_;
155 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_; 156 std::unique_ptr<PacketLossFractionSmoother> packet_loss_fraction_smoother_;
156 AudioNetworkAdaptorCreator audio_network_adaptor_creator_; 157 AudioNetworkAdaptorCreator audio_network_adaptor_creator_;
157 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; 158 std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_;
158 159
159 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); 160 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus);
160 }; 161 };
161 162
162 } // namespace webrtc 163 } // namespace webrtc
163 164
164 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_ 165 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698