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:
@ -52,6 +52,7 @@ rtc_static_library("common_video") {
|
|||||||
"../rtc_base:rtc_base",
|
"../rtc_base:rtc_base",
|
||||||
"../rtc_base:rtc_task_queue",
|
"../rtc_base:rtc_task_queue",
|
||||||
"../rtc_base:safe_minmax",
|
"../rtc_base:safe_minmax",
|
||||||
|
"../system_wrappers:metrics",
|
||||||
"//third_party/abseil-cpp/absl/types:optional",
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
"//third_party/libyuv",
|
"//third_party/libyuv",
|
||||||
]
|
]
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
#include "rtc_base/timeutils.h"
|
#include "rtc_base/timeutils.h"
|
||||||
|
#include "system_wrappers/include/metrics.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace {
|
namespace {
|
||||||
@ -37,7 +38,13 @@ uint32_t EnsureValidRenderDelay(uint32_t render_delay) {
|
|||||||
VideoRenderFrames::VideoRenderFrames(uint32_t render_delay_ms)
|
VideoRenderFrames::VideoRenderFrames(uint32_t render_delay_ms)
|
||||||
: render_delay_ms_(EnsureValidRenderDelay(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) {
|
int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
|
||||||
const int64_t time_now = rtc::TimeMillis();
|
const int64_t time_now = rtc::TimeMillis();
|
||||||
@ -47,12 +54,14 @@ int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
|
|||||||
if (!incoming_frames_.empty() &&
|
if (!incoming_frames_.empty() &&
|
||||||
new_frame.render_time_ms() + kOldRenderTimestampMS < time_now) {
|
new_frame.render_time_ms() + kOldRenderTimestampMS < time_now) {
|
||||||
RTC_LOG(LS_WARNING) << "Too old frame, timestamp=" << new_frame.timestamp();
|
RTC_LOG(LS_WARNING) << "Too old frame, timestamp=" << new_frame.timestamp();
|
||||||
|
++frames_dropped_;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_frame.render_time_ms() > time_now + kFutureRenderTimestampMS) {
|
if (new_frame.render_time_ms() > time_now + kFutureRenderTimestampMS) {
|
||||||
RTC_LOG(LS_WARNING) << "Frame too long into the future, timestamp="
|
RTC_LOG(LS_WARNING) << "Frame too long into the future, timestamp="
|
||||||
<< new_frame.timestamp();
|
<< new_frame.timestamp();
|
||||||
|
++frames_dropped_;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,15 +71,17 @@ int32_t VideoRenderFrames::AddFrame(VideoFrame&& new_frame) {
|
|||||||
<< ", latest=" << last_render_time_ms_;
|
<< ", latest=" << last_render_time_ms_;
|
||||||
// For more details, see bug:
|
// For more details, see bug:
|
||||||
// https://bugs.chromium.org/p/webrtc/issues/detail?id=7253
|
// https://bugs.chromium.org/p/webrtc/issues/detail?id=7253
|
||||||
|
++frames_dropped_;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_render_time_ms_ = new_frame.render_time_ms();
|
last_render_time_ms_ = new_frame.render_time_ms();
|
||||||
incoming_frames_.emplace_back(std::move(new_frame));
|
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: "
|
RTC_LOG(LS_WARNING) << "Stored incoming frames: "
|
||||||
<< incoming_frames_.size();
|
<< incoming_frames_.size();
|
||||||
|
}
|
||||||
return static_cast<int32_t>(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;
|
absl::optional<VideoFrame> render_frame;
|
||||||
// Get the newest frame that can be released for rendering.
|
// Get the newest frame that can be released for rendering.
|
||||||
while (!incoming_frames_.empty() && TimeToNextFrameRelease() <= 0) {
|
while (!incoming_frames_.empty() && TimeToNextFrameRelease() <= 0) {
|
||||||
|
if (render_frame) {
|
||||||
|
++frames_dropped_;
|
||||||
|
}
|
||||||
render_frame = std::move(incoming_frames_.front());
|
render_frame = std::move(incoming_frames_.front());
|
||||||
incoming_frames_.pop_front();
|
incoming_frames_.pop_front();
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ class VideoRenderFrames {
|
|||||||
const uint32_t render_delay_ms_;
|
const uint32_t render_delay_ms_;
|
||||||
|
|
||||||
int64_t last_render_time_ms_ = 0;
|
int64_t last_render_time_ms_ = 0;
|
||||||
|
size_t frames_dropped_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -502,7 +502,7 @@ void SendStatisticsProxy::UmaSamplesContainer::UpdateHistograms(
|
|||||||
RTC_HISTOGRAMS_PERCENTAGE(
|
RTC_HISTOGRAMS_PERCENTAGE(
|
||||||
kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
|
kIndex, uma_prefix_ + "SentPacketsLostInPercent", fraction_lost);
|
||||||
log_stream << uma_prefix_ << "SentPacketsLostInPercent "
|
log_stream << uma_prefix_ << "SentPacketsLostInPercent "
|
||||||
<< fraction_lost;
|
<< fraction_lost << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// The RTCP packet type counters, delivered via the
|
// The RTCP packet type counters, delivered via the
|
||||||
|
Reference in New Issue
Block a user