Add UMA metric and logging of frames dropped in the render queue.

Bug: b/80195113
Change-Id: I7a696fe58ccf4e2bc7502438c2f58beb65848d25
Reviewed-on: https://webrtc-review.googlesource.com/c/104062
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25016}
This commit is contained in:
Stefan Holmer
2018-10-05 13:47:12 +02:00
parent 96a0f61917
commit 0a5792e907
4 changed files with 19 additions and 3 deletions

View File

@ -52,6 +52,7 @@ rtc_static_library("common_video") {
"../rtc_base:rtc_base",
"../rtc_base:rtc_task_queue",
"../rtc_base:safe_minmax",
"../system_wrappers:metrics",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/libyuv",
]

View File

@ -14,6 +14,7 @@
#include "rtc_base/logging.h"
#include "rtc_base/timeutils.h"
#include "system_wrappers/include/metrics.h"
namespace webrtc {
namespace {
@ -37,7 +38,13 @@ uint32_t EnsureValidRenderDelay(uint32_t render_delay) {
VideoRenderFrames::VideoRenderFrames(uint32_t render_delay_ms)
: render_delay_ms_(EnsureValidRenderDelay(render_delay_ms)) {}
VideoRenderFrames::~VideoRenderFrames() = default;
VideoRenderFrames::~VideoRenderFrames() {
frames_dropped_ += incoming_frames_.size();
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DroppedFrames.RenderQueue",
frames_dropped_);
RTC_LOG(LS_INFO) << "WebRTC.Video.DroppedFrames.RenderQueue "
<< frames_dropped_;
}
int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
const int64_t time_now = rtc::TimeMillis();
@ -47,12 +54,14 @@ int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
if (!incoming_frames_.empty() &&
new_frame.render_time_ms() + kOldRenderTimestampMS < time_now) {
RTC_LOG(LS_WARNING) << "Too old frame, timestamp=" << new_frame.timestamp();
++frames_dropped_;
return -1;
}
if (new_frame.render_time_ms() > time_now + kFutureRenderTimestampMS) {
RTC_LOG(LS_WARNING) << "Frame too long into the future, timestamp="
<< new_frame.timestamp();
++frames_dropped_;
return -1;
}
@ -62,15 +71,17 @@ int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
<< ", latest=" << last_render_time_ms_;
// For more details, see bug:
// https://bugs.chromium.org/p/webrtc/issues/detail?id=7253
++frames_dropped_;
return -1;
}
last_render_time_ms_ = new_frame.render_time_ms();
incoming_frames_.emplace_back(std::move(new_frame));
if (incoming_frames_.size() > kMaxIncomingFramesBeforeLogged)
if (incoming_frames_.size() > kMaxIncomingFramesBeforeLogged) {
RTC_LOG(LS_WARNING) << "Stored incoming frames: "
<< incoming_frames_.size();
}
return static_cast<int32_t>(incoming_frames_.size());
}
@ -78,6 +89,9 @@ absl::optional<VideoFrame> VideoRenderFrames::FrameToRender() {
absl::optional<VideoFrame> render_frame;
// Get the newest frame that can be released for rendering.
while (!incoming_frames_.empty() && TimeToNextFrameRelease() <= 0) {
if (render_frame) {
++frames_dropped_;
}
render_frame = std::move(incoming_frames_.front());
incoming_frames_.pop_front();
}

View File

@ -46,6 +46,7 @@ class VideoRenderFrames {
const uint32_t render_delay_ms_;
int64_t last_render_time_ms_ = 0;
size_t frames_dropped_ = 0;
};
} // namespace webrtc

View File

@ -502,7 +502,7 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
RTC_HISTOGRAMS_PERCENTAGE(
kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
log_stream << uma_prefix_ << "SentPacketsLostInPercent "
<< fraction_lost;
<< fraction_lost << "\n";
}
// The RTCP packet type counters, delivered via the