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

Unified Diff: media/renderers/video_renderer_impl.cc

Issue 2363983003: Transition to have nothing if background rendering evicts all frames. (Closed)
Patch Set: Created 4 years, 3 months 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 2b662c65f264318900524d15e4234134ccd6e745..c6902976272cad8a0a1d0c3e88d49c994559e292 100644
--- a/media/renderers/video_renderer_impl.cc
+++ b/media/renderers/video_renderer_impl.cc
@@ -316,8 +316,10 @@ void VideoRendererImpl::OnTimeStateChanged(bool time_progressing) {
// otherwise playback may hang indefinitely. Note: There are no effective
// frames queued at this point, otherwise FrameReady() would have canceled
// the underflow state before reaching this point.
- if (buffering_state_ == BUFFERING_HAVE_NOTHING)
+ if (buffering_state_ == BUFFERING_HAVE_NOTHING) {
+ base::AutoLock al(lock_);
watk 2016/09/26 23:12:43 I just noticed this. The comment on l.292 says not
DaleCurtis 2016/09/26 23:23:42 I think the comment is out of date since we no lon
RemoveFramesForUnderflowOrBackgroundRendering();
+ }
}
}
@@ -456,6 +458,14 @@ void VideoRendererImpl::TransitionToHaveNothing() {
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
+ TransitionToHaveNothing_Locked();
+}
+
+void VideoRendererImpl::TransitionToHaveNothing_Locked() {
+ DVLOG(3) << __func__;
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ lock_.AssertAcquired();
+
if (buffering_state_ != BUFFERING_HAVE_ENOUGH || HaveEnoughData_Locked())
return;
@@ -657,6 +667,12 @@ void VideoRendererImpl::RemoveFramesForUnderflowOrBackgroundRendering() {
frames_dropped_ += algorithm_->frames_queued();
algorithm_->Reset(
VideoRendererAlgorithm::ResetFlag::kPreserveNextFrameEstimates);
+
+ // It's possible in the background rendering case for us to expire enough
+ // frames that we need to transition from HAVE_ENOUGH => HAVE_NOTHING. Just
+ // calling this function will check if we need to transition or not.
+ if (buffering_state_ == BUFFERING_HAVE_ENOUGH)
+ TransitionToHaveNothing_Locked();
}
}
« 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