Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Unified Diff: media/filters/video_renderer_algorithm.cc

Issue 2502093002: Adjust VideoRendererAlgorithm for |frame_dropping_disabled_| (Closed)
Patch Set: Style fixes, new unit test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/video_renderer_algorithm.h ('k') | media/filters/video_renderer_algorithm_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_algorithm.cc
diff --git a/media/filters/video_renderer_algorithm.cc b/media/filters/video_renderer_algorithm.cc
index 71783cf8ca9d80ba76aa1c1e107dcee03e9a4c0f..38915ddf57e649a6775dfde25b0cb14bdb311cbb 100644
--- a/media/filters/video_renderer_algorithm.cc
+++ b/media/filters/video_renderer_algorithm.cc
@@ -685,6 +685,24 @@ void VideoRendererAlgorithm::UpdateEffectiveFramesQueued() {
return;
}
+ // Determine the lower bound of the number of effective queues first.
+ // Normally, this is 0.
+ size_t min_frames_queued = 0;
+
+ // If frame dropping is disabled, the lower bound is the number of frames
+ // that were not rendered yet.
+ if (frame_dropping_disabled_) {
+ min_frames_queued = std::count_if(
+ frame_queue_.cbegin(), frame_queue_.cend(),
+ [](const ReadyFrame& frame) { return frame.render_count == 0; });
+ }
+
+ // Next, see if can report more frames as queued.
+ effective_frames_queued_ =
+ std::max(min_frames_queued, CountEffectiveFramesQueued());
+}
+
+size_t VideoRendererAlgorithm::CountEffectiveFramesQueued() const {
// If we don't have cadence, subtract off any frames which are before
// the last rendered frame or are past their expected rendering time.
if (!cadence_estimator_.has_cadence()) {
@@ -694,16 +712,13 @@ void VideoRendererAlgorithm::UpdateEffectiveFramesQueued() {
if (frame.end_time.is_null() || frame.end_time > last_deadline_max_)
break;
}
- effective_frames_queued_ = frame_queue_.size() - expired_frames;
- return;
+ return frame_queue_.size() - expired_frames;
}
// Find the first usable frame to start counting from.
const int start_index = FindBestFrameByCadence(nullptr);
- if (start_index < 0) {
- effective_frames_queued_ = 0;
- return;
- }
+ if (start_index < 0)
+ return 0;
const base::TimeTicks minimum_start_time =
last_deadline_max_ - max_acceptable_drift_;
@@ -715,8 +730,7 @@ void VideoRendererAlgorithm::UpdateEffectiveFramesQueued() {
++renderable_frame_count;
}
}
-
- effective_frames_queued_ = renderable_frame_count;
+ return renderable_frame_count;
}
} // namespace media
« no previous file with comments | « media/filters/video_renderer_algorithm.h ('k') | media/filters/video_renderer_algorithm_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698