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

Unified Diff: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc

Issue 2592253004: Make a the decisions of ANA optional for the opus encoder. (Closed)
Patch Set: Respond to comments. 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
index af66cd3634ee1cdabcfab57f18c80c953a0a9391..c6bac621c31e63b0fd0f4b2f29f23a735c48e983 100644
--- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
+++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc
@@ -491,23 +491,21 @@ void AudioEncoderOpus::SetTargetBitrate(int bits_per_second) {
void AudioEncoderOpus::ApplyAudioNetworkAdaptor() {
auto config = audio_network_adaptor_->GetEncoderRuntimeConfig();
- // |audio_network_adaptor_| is supposed to be configured to output all
- // following parameters.
- RTC_DCHECK(config.bitrate_bps);
- RTC_DCHECK(config.frame_length_ms);
- RTC_DCHECK(config.uplink_packet_loss_fraction);
- RTC_DCHECK(config.enable_fec);
- RTC_DCHECK(config.enable_dtx);
- RTC_DCHECK(config.num_channels);
-
- RTC_DCHECK(*config.frame_length_ms == 20 || *config.frame_length_ms == 60);
-
- SetTargetBitrate(*config.bitrate_bps);
- SetFrameLength(*config.frame_length_ms);
- SetFec(*config.enable_fec);
- SetProjectedPacketLossRate(*config.uplink_packet_loss_fraction);
- SetDtx(*config.enable_dtx);
- SetNumChannelsToEncode(*config.num_channels);
+ RTC_DCHECK(!config.frame_length_ms || *config.frame_length_ms == 20 ||
+ *config.frame_length_ms == 60);
+
+ if (config.bitrate_bps)
+ SetTargetBitrate(*config.bitrate_bps);
+ if (config.frame_length_ms)
+ SetFrameLength(*config.frame_length_ms);
+ if (config.enable_fec)
+ SetFec(*config.enable_fec);
+ if (config.uplink_packet_loss_fraction)
+ SetProjectedPacketLossRate(*config.uplink_packet_loss_fraction);
+ if (config.enable_dtx)
+ SetDtx(*config.enable_dtx);
+ if (config.num_channels)
+ SetNumChannelsToEncode(*config.num_channels);
}
std::unique_ptr<AudioNetworkAdaptor>

Powered by Google App Engine
This is Rietveld 408576698