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

Unified Diff: webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc

Issue 1203803004: Adding a new ChangeLogger class to handle UMA logging of bitrates (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing a typo Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
index c01466f8c02f970e577d7c799dbf2da1b1a5b7fe..9c3183271b75bcbdaca46d20cd915d8ecee05323 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.cc
@@ -122,6 +122,14 @@ void ConvertEncodedInfoToFragmentationHeader(
}
} // namespace
+void AudioCodingModuleImpl::ChangeLogger::MaybeLog(int value) {
+ if (value != last_value_ || first_time_) {
+ first_time_ = false;
+ last_value_ = value;
+ RTC_HISTOGRAM_COUNTS_100(histogram_name_, value);
+ }
+}
+
AudioCodingModuleImpl::AudioCodingModuleImpl(
const AudioCodingModule::Config& config)
: acm_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
@@ -129,6 +137,7 @@ AudioCodingModuleImpl::AudioCodingModuleImpl(
expected_codec_ts_(0xD87F3F9F),
expected_in_ts_(0xD87F3F9F),
receiver_(config),
+ bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"),
previous_pltype_(255),
aux_rtp_header_(NULL),
receiver_initialized_(false),
@@ -185,6 +194,7 @@ int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) {
encoded_info = audio_encoder->Encode(rtp_timestamp, input_data.audio,
input_data.length_per_channel,
sizeof(stream), stream);
+ bitrate_logger_.MaybeLog(audio_encoder->GetTargetBitrate() / 1000);
if (encoded_info.encoded_bytes == 0 && !encoded_info.send_even_if_empty) {
// Not enough data.
return 0;
@@ -296,9 +306,6 @@ void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) {
CriticalSectionScoped lock(acm_crit_sect_);
if (codec_manager_.CurrentEncoder()) {
codec_manager_.CurrentEncoder()->SetTargetBitrate(bitrate_bps);
- RTC_HISTOGRAM_COUNTS_100(
- HISTOGRAM_NAME_AUDIO_TARGET_BITRATE_IN_KBPS,
- codec_manager_.CurrentEncoder()->GetTargetBitrate() / 1000);
}
}

Powered by Google App Engine
This is Rietveld 408576698