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

Unified Diff: webrtc/modules/audio_coding/codecs/audio_encoder.cc

Issue 2528933002: Adding OnReceivedOverhead to AudioEncoder. (Closed)
Patch Set: Created 4 years, 1 month 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/audio_encoder.cc
diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.cc b/webrtc/modules/audio_coding/codecs/audio_encoder.cc
index 956c4e086f0dbf244cb348ad93083d19ad252411..fb147b9df8a9cb520a7ceb2fa76ca7dd3421fd9c 100644
--- a/webrtc/modules/audio_coding/codecs/audio_encoder.cc
+++ b/webrtc/modules/audio_coding/codecs/audio_encoder.cc
@@ -12,6 +12,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/trace_event.h"
+#include "webrtc/system_wrappers/include/field_trial.h"
namespace webrtc {
@@ -24,6 +25,9 @@ AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(
AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(EncodedInfo&&) =
default;
+AudioEncoder::AudioEncoder() = default;
+AudioEncoder::~AudioEncoder() = default;
+
int AudioEncoder::RtpTimestampRateHz() const {
return SampleRateHz();
}
@@ -82,11 +86,26 @@ void AudioEncoder::OnReceivedUplinkPacketLossFraction(
}
void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
- SetTargetBitrate(target_audio_bitrate_bps);
+ if (webrtc::field_trial::FindFullName("WebRTC-SendSideBwe-WithOverhead") ==
+ "Enabled") {
+ if (!overhead_bytes_per_packet_) {
+ // Ignore the target bitrate is overhead is unknown.
+ return;
+ }
+ int overhead_rate =
+ 8 * 1000 * *overhead_bytes_per_packet_ / Num10MsFramesInNextPacket();
michaelt 2016/11/24 13:55:18 I think this calculation is wrong by a a factor of
+ SetTargetBitrate(std::max(0, target_audio_bitrate_bps - overhead_rate));
+ } else {
+ SetTargetBitrate(target_audio_bitrate_bps);
+ }
}
void AudioEncoder::OnReceivedRtt(int rtt_ms) {}
+void AudioEncoder::OnReceivedOverhead(size_t overhead_bytes_per_packet) {
+ overhead_bytes_per_packet_ = rtc::Optional<size_t>(overhead_bytes_per_packet);
+}
+
void AudioEncoder::SetReceiverFrameLengthRange(int min_frame_length_ms,
int max_frame_length_ms) {}

Powered by Google App Engine
This is Rietveld 408576698