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

Side by Side Diff: media/renderers/video_renderer_impl.cc

Issue 1928083002: Ignore sink start attempts when no frames are present. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2717
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/base/null_video_sink_unittest.cc ('k') | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/renderers/video_renderer_impl.h" 5 #include "media/renderers/video_renderer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 // WARNING: Do not attempt to use |lock_| here as this may be a reentrant call 293 // WARNING: Do not attempt to use |lock_| here as this may be a reentrant call
294 // in response to callbacks firing above. 294 // in response to callbacks firing above.
295 295
296 if (sink_started_ == time_progressing_) 296 if (sink_started_ == time_progressing_)
297 return; 297 return;
298 298
299 if (time_progressing_) { 299 if (time_progressing_) {
300 // If only an EOS frame came in after a seek, the renderer may not have 300 // If only an EOS frame came in after a seek, the renderer may not have
301 // received the ended event yet though we've posted it. 301 // received the ended event yet though we've posted it.
302 if (!rendered_end_of_stream_) 302 if (rendered_end_of_stream_)
303 StartSink(); 303 return;
304
305 // If we have no frames queued, there is a pending buffering state change in
306 // flight and we should ignore the start attempt.
307 if (!algorithm_->frames_queued()) {
308 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING);
309 return;
310 }
311
312 StartSink();
304 } else { 313 } else {
305 StopSink(); 314 StopSink();
306 315
307 // Make sure we expire everything we can if we can't read anymore currently, 316 // Make sure we expire everything we can if we can't read anymore currently,
308 // otherwise playback may hang indefinitely. Note: There are no effective 317 // otherwise playback may hang indefinitely. Note: There are no effective
309 // frames queued at this point, otherwise FrameReady() would have canceled 318 // frames queued at this point, otherwise FrameReady() would have canceled
310 // the underflow state before reaching this point. 319 // the underflow state before reaching this point.
311 if (buffering_state_ == BUFFERING_HAVE_NOTHING) 320 if (buffering_state_ == BUFFERING_HAVE_NOTHING)
312 RemoveFramesForUnderflowOrBackgroundRendering(); 321 RemoveFramesForUnderflowOrBackgroundRendering();
313 } 322 }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 // the entire queue. Note: this may cause slight inaccuracies in the number 665 // the entire queue. Note: this may cause slight inaccuracies in the number
657 // of dropped frames since the frame may have been rendered before. 666 // of dropped frames since the frame may have been rendered before.
658 if (!sink_started_ && !algorithm_->effective_frames_queued()) { 667 if (!sink_started_ && !algorithm_->effective_frames_queued()) {
659 frames_dropped_ += algorithm_->frames_queued(); 668 frames_dropped_ += algorithm_->frames_queued();
660 algorithm_->Reset( 669 algorithm_->Reset(
661 VideoRendererAlgorithm::ResetFlag::kPreserveNextFrameEstimates); 670 VideoRendererAlgorithm::ResetFlag::kPreserveNextFrameEstimates);
662 } 671 }
663 } 672 }
664 673
665 } // namespace media 674 } // namespace media
OLDNEW
« no previous file with comments | « media/base/null_video_sink_unittest.cc ('k') | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698