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

Unified Diff: media/renderers/video_renderer_impl.cc

Issue 2570013003: Fix underflow correction occurring during normal rendering. (Closed)
Patch Set: Created 4 years 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/renderers/video_renderer_impl.h ('k') | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/video_renderer_impl.cc
diff --git a/media/renderers/video_renderer_impl.cc b/media/renderers/video_renderer_impl.cc
index 2c13377bd0519218571104f9a3559dbc8932ca14..7c7815c57b285b45a4622bd274b4fca4450a8910 100644
--- a/media/renderers/video_renderer_impl.cc
+++ b/media/renderers/video_renderer_impl.cc
@@ -638,14 +638,8 @@ bool VideoRendererImpl::IsBeforeStartTime(base::TimeDelta timestamp) {
}
void VideoRendererImpl::RemoveFramesForUnderflowOrBackgroundRendering() {
- // Nothing to do if we're not underflowing, background rendering, or frame
- // dropping is disabled (test only).
- const bool have_nothing = buffering_state_ == BUFFERING_HAVE_NOTHING;
- if (!was_background_rendering_ && !have_nothing && !drop_frames_)
- return;
-
- // If there are no frames to remove, nothing can be done.
- if (!algorithm_->frames_queued())
+ // Nothing to do if frame dropping is disabled for testing or we have nothing.
+ if (!drop_frames_ || !algorithm_->frames_queued())
return;
// If we're paused for prerolling (current time is 0), don't expire any
@@ -664,13 +658,6 @@ void VideoRendererImpl::RemoveFramesForUnderflowOrBackgroundRendering() {
return;
}
- // Use the current media wall clock time plus the frame duration since
- // RemoveExpiredFrames() is expecting the end point of an interval (it will
- // subtract from the given value). It's important to always call this so
- // that frame statistics are updated correctly.
- frames_dropped_ += algorithm_->RemoveExpiredFrames(
- current_time + algorithm_->average_frame_duration());
-
// If we've paused for underflow, and still have no effective frames, clear
// the entire queue. Note: this may cause slight inaccuracies in the number
// of dropped frames since the frame may have been rendered before.
@@ -685,7 +672,21 @@ void VideoRendererImpl::RemoveFramesForUnderflowOrBackgroundRendering() {
// calling this function will check if we need to transition or not.
if (buffering_state_ == BUFFERING_HAVE_ENOUGH)
TransitionToHaveNothing_Locked();
+ return;
}
+
+ // Use the current media wall clock time plus the frame duration since
+ // RemoveExpiredFrames() is expecting the end point of an interval (it will
+ // subtract from the given value). It's important to always call this so
+ // that frame statistics are updated correctly.
+ if (buffering_state_ == BUFFERING_HAVE_NOTHING) {
+ frames_dropped_ += algorithm_->RemoveExpiredFrames(
+ current_time + algorithm_->average_frame_duration());
+ return;
+ }
+
+ // If we reach this point, the normal rendering process will take care of
+ // removing any expired frames.
}
void VideoRendererImpl::CheckForMetadataChanges(VideoPixelFormat pixel_format,
« no previous file with comments | « media/renderers/video_renderer_impl.h ('k') | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698