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

Unified Diff: webrtc/modules/audio_coding/main/acm2/codec_owner.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: 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/codec_owner.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/codec_owner.cc b/webrtc/modules/audio_coding/main/acm2/codec_owner.cc
index 5c1e37b5b0c2f493c067067369ab0c2a60038618..53c5f96538690d77d7120911e2047cf9fc4813b4 100644
--- a/webrtc/modules/audio_coding/main/acm2/codec_owner.cc
+++ b/webrtc/modules/audio_coding/main/acm2/codec_owner.cc
@@ -21,8 +21,7 @@
#include "webrtc/modules/audio_coding/codecs/opus/interface/audio_encoder_opus.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/include/audio_encoder_pcm16b.h"
#include "webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
-#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
-#include "webrtc/system_wrappers/interface/metrics.h"
+#include "webrtc/modules/audio_coding/main/acm2/delayed_logger.h"
namespace webrtc {
namespace acm2 {
@@ -77,8 +76,10 @@ bool IsG722(const CodecInst& codec) {
}
} // namespace
-CodecOwner::CodecOwner()
- : isac_is_encoder_(false), external_speech_encoder_(nullptr) {
+CodecOwner::CodecOwner(DelayedLogger* bitrate_logger)
+ : isac_is_encoder_(false),
+ external_speech_encoder_(nullptr),
+ bitrate_logger_(bitrate_logger) {
}
CodecOwner::~CodecOwner() = default;
@@ -182,8 +183,9 @@ void CodecOwner::SetEncoders(const CodecInst& speech_inst,
&isac_is_encoder_);
external_speech_encoder_ = nullptr;
ChangeCngAndRed(cng_payload_type, vad_mode, red_payload_type);
- RTC_HISTOGRAM_COUNTS_100(HISTOGRAM_NAME_AUDIO_TARGET_BITRATE_IN_KBPS,
- SpeechEncoder()->GetTargetBitrate() / 1000);
+ if (bitrate_logger_) {
+ bitrate_logger_->SetValue(SpeechEncoder()->GetTargetBitrate() / 1000);
+ }
}
void CodecOwner::SetEncoders(AudioEncoderMutable* external_speech_encoder,
@@ -194,8 +196,9 @@ void CodecOwner::SetEncoders(AudioEncoderMutable* external_speech_encoder,
speech_encoder_.reset();
isac_is_encoder_ = false;
ChangeCngAndRed(cng_payload_type, vad_mode, red_payload_type);
- RTC_HISTOGRAM_COUNTS_100(HISTOGRAM_NAME_AUDIO_TARGET_BITRATE_IN_KBPS,
- SpeechEncoder()->GetTargetBitrate() / 1000);
+ if (bitrate_logger_) {
+ bitrate_logger_->SetValue(SpeechEncoder()->GetTargetBitrate() / 1000);
+ }
}
void CodecOwner::ChangeCngAndRed(int cng_payload_type,

Powered by Google App Engine
This is Rietveld 408576698