Add UMA logging for target audio bitrate

This CL logs the target audio bitrate to a UMA histogram called
WebRTC.Audio.TargetBitrateInKbps. It logs the rate when a codec is
created, and when the target is explicitly updated. Note that since
each codec implementation is free to change or ignore the target
value, there is no guarantee that the logged value will actually be
used as the target.

BUG=chromium:488124

Review URL: https://codereview.webrtc.org/1178053002

Cr-Commit-Position: refs/heads/master@{#9484}
This commit is contained in:
henrik.lundin
2015-06-22 06:35:09 -07:00
committed by Commit bot
parent bdc0b0d869
commit 6b4a564d21
6 changed files with 24 additions and 1 deletions

View File

@ -13,6 +13,8 @@
#include "webrtc/base/checks.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h"
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
#include "webrtc/system_wrappers/interface/metrics.h"
#include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc {
@ -312,6 +314,9 @@ int CodecManager::RegisterEncoder(const CodecInst& send_codec) {
// Check if a change in Rate is required.
if (send_codec.rate != send_codec_inst_.rate) {
codec_owner_.SpeechEncoder()->SetTargetBitrate(send_codec.rate);
RTC_HISTOGRAM_COUNTS_100(
HISTOGRAM_NAME_AUDIO_TARGET_BITRATE_IN_KBPS,
codec_owner_.SpeechEncoder()->GetTargetBitrate() / 1000);
send_codec_inst_.rate = send_codec.rate;
}