Add new UMA metric for NetEq target buffer delay
The UMA metric will log the same information that goes into the
googPreferredJitterBufferMs stat.
Bug: webrtc:8488
Change-Id: I4e4e1e362dd42377105d52d2c4cd49c1ecb1a90d
Reviewed-on: https://webrtc-review.googlesource.com/26740
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20923}
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index e9a14be..0d5dcae 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -300,6 +300,10 @@
return neteq_->FilteredCurrentDelayMs();
}
+int AcmReceiver::TargetDelayMs() const {
+ return neteq_->TargetDelayMs();
+}
+
int AcmReceiver::LastAudioCodec(CodecInst* codec) const {
rtc::CritScope lock(&crit_sect_);
if (!last_audio_decoder_) {
diff --git a/modules/audio_coding/acm2/acm_receiver.h b/modules/audio_coding/acm2/acm_receiver.h
index 3206402..5c6b36f 100644
--- a/modules/audio_coding/acm2/acm_receiver.h
+++ b/modules/audio_coding/acm2/acm_receiver.h
@@ -204,6 +204,10 @@
//
int FilteredCurrentDelayMs() const;
+ // Returns the current target delay for NetEq in ms.
+ //
+ int TargetDelayMs() const;
+
//
// Get the audio codec associated with the last non-CNG/non-DTMF received
// payload. If no non-CNG/non-DTMF packet is received -1 is returned,
diff --git a/modules/audio_coding/acm2/audio_coding_module.cc b/modules/audio_coding/acm2/audio_coding_module.cc
index 18325f4..53b9177 100644
--- a/modules/audio_coding/acm2/audio_coding_module.cc
+++ b/modules/audio_coding/acm2/audio_coding_module.cc
@@ -164,6 +164,8 @@
int FilteredCurrentDelayMs() const override;
+ int TargetDelayMs() const override;
+
// Get 10 milliseconds of raw audio data to play out, and
// automatic resample to the requested frequency if > 0.
int PlayoutData10Ms(int desired_freq_hz,
@@ -1193,6 +1195,10 @@
return receiver_.FilteredCurrentDelayMs();
}
+int AudioCodingModuleImpl::TargetDelayMs() const {
+ return receiver_.TargetDelayMs();
+}
+
bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
if (!encoder_stack_) {
RTC_LOG(LS_ERROR) << caller_name << " failed: No send codec is registered.";
diff --git a/modules/audio_coding/include/audio_coding_module.h b/modules/audio_coding/include/audio_coding_module.h
index 41756fb..12c98ee 100644
--- a/modules/audio_coding/include/audio_coding_module.h
+++ b/modules/audio_coding/include/audio_coding_module.h
@@ -656,6 +656,12 @@
virtual int FilteredCurrentDelayMs() const = 0;
///////////////////////////////////////////////////////////////////////////
+ // int FilteredCurrentDelayMs()
+ // Returns the current target delay for NetEq in ms.
+ //
+ virtual int TargetDelayMs() const = 0;
+
+ ///////////////////////////////////////////////////////////////////////////
// int32_t PlayoutData10Ms(
// Get 10 milliseconds of raw audio data for playout, at the given sampling
// frequency. ACM will perform a resampling if required.
diff --git a/modules/audio_coding/neteq/include/neteq.h b/modules/audio_coding/neteq/include/neteq.h
index d66a3ea..00ed7cd 100644
--- a/modules/audio_coding/neteq/include/neteq.h
+++ b/modules/audio_coding/neteq/include/neteq.h
@@ -208,7 +208,7 @@
// Returns the current target delay in ms. This includes any extra delay
// requested through SetMinimumDelay.
- virtual int TargetDelayMs() = 0;
+ virtual int TargetDelayMs() const = 0;
// Returns the current total delay (packet buffer and sync buffer) in ms.
virtual int CurrentDelayMs() const = 0;
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index 738e974..6836c7e 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -311,7 +311,7 @@
return kNotImplemented;
}
-int NetEqImpl::TargetDelayMs() {
+int NetEqImpl::TargetDelayMs() const {
rtc::CritScope lock(&crit_sect_);
RTC_DCHECK(delay_manager_.get());
// The value from TargetLevel() is in number of packets, represented in Q8.
diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h
index 8dca6a5..a922bcd 100644
--- a/modules/audio_coding/neteq/neteq_impl.h
+++ b/modules/audio_coding/neteq/neteq_impl.h
@@ -161,7 +161,7 @@
int SetTargetDelay() override;
- int TargetDelayMs() override;
+ int TargetDelayMs() const override;
int CurrentDelayMs() const override;
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc
index eda3948..5bc66ff 100644
--- a/voice_engine/channel.cc
+++ b/voice_engine/channel.cc
@@ -556,6 +556,8 @@
}
{
+ RTC_HISTOGRAM_COUNTS_1000("WebRTC.Audio.TargetJitterBufferDelayMs",
+ audio_coding_->TargetDelayMs());
const int jitter_buffer_delay = audio_coding_->FilteredCurrentDelayMs();
rtc::CritScope lock(&video_sync_lock_);
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Audio.ReceiverDelayEstimateMs",