Add histogram stats for jitter buffer delay and current/target delay for received video streams:
- "WebRTC.Video.JitterBufferDelayInMs"
- "WebRTC.Video.TargetDelayInMs" (jitter delay + decode time + render delay)
- "WebRTC.Video.CurrentDelayInMs"

BUG=

Review-Url: https://codereview.webrtc.org/1885393002
Cr-Original-Commit-Position: refs/heads/master@{#12539}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 8688a4e2b53865cfd647a263f8685c3b6de8dacc
diff --git a/video/end_to_end_tests.cc b/video/end_to_end_tests.cc
index 9094b13..ef1771a 100644
--- a/video/end_to_end_tests.cc
+++ b/video/end_to_end_tests.cc
@@ -2147,6 +2147,9 @@
       "WebRTC.Video.DecodedFramesPerSecond"));
   EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.RenderFramesPerSecond"));
 
+  EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.JitterBufferDelayInMs"));
+  EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.TargetDelayInMs"));
+  EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.CurrentDelayInMs"));
   EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.OnewayDelayInMs"));
   EXPECT_EQ(
       1, test::NumHistogramSamples("WebRTC.Video.RenderSqrtPixelsPerSecond"));
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index ff41924..97c1cf1 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -77,6 +77,22 @@
   if (decode_ms != -1)
     RTC_LOGGED_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms);
 
+  int jb_delay_ms = jitter_buffer_delay_counter_.Avg(kMinRequiredDecodeSamples);
+  if (jb_delay_ms != -1) {
+    RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
+                                      jb_delay_ms);
+  }
+  int target_delay_ms = target_delay_counter_.Avg(kMinRequiredDecodeSamples);
+  if (target_delay_ms != -1) {
+    RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs",
+                                      target_delay_ms);
+  }
+  int current_delay_ms = current_delay_counter_.Avg(kMinRequiredDecodeSamples);
+  if (current_delay_ms != -1) {
+    RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs",
+                                      current_delay_ms);
+  }
+
   int delay_ms = delay_counter_.Avg(kMinRequiredDecodeSamples);
   if (delay_ms != -1)
     RTC_LOGGED_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", delay_ms);
@@ -170,6 +186,9 @@
   stats_.min_playout_delay_ms = min_playout_delay_ms;
   stats_.render_delay_ms = render_delay_ms;
   decode_time_counter_.Add(decode_ms);
+  jitter_buffer_delay_counter_.Add(jitter_buffer_ms);
+  target_delay_counter_.Add(target_delay_ms);
+  current_delay_counter_.Add(current_delay_ms);
   // Network delay (rtt/2) + target_delay_ms (jitter delay + decode time +
   // render delay).
   delay_counter_.Add(target_delay_ms + rtt_ms / 2);
diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h
index a1ff0eb..879100a 100644
--- a/video/receive_statistics_proxy.h
+++ b/video/receive_statistics_proxy.h
@@ -108,6 +108,9 @@
   SampleCounter render_height_counter_ GUARDED_BY(crit_);
   SampleCounter sync_offset_counter_ GUARDED_BY(crit_);
   SampleCounter decode_time_counter_ GUARDED_BY(crit_);
+  SampleCounter jitter_buffer_delay_counter_ GUARDED_BY(crit_);
+  SampleCounter target_delay_counter_ GUARDED_BY(crit_);
+  SampleCounter current_delay_counter_ GUARDED_BY(crit_);
   SampleCounter delay_counter_ GUARDED_BY(crit_);
   ReportBlockStats report_block_stats_ GUARDED_BY(crit_);
   QpCounters qp_counters_;  // Only accessed on the decoding thread.