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

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

Issue 391023002: Add playback underflow logic to media::VideoRendererImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/filters/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/filters/video_renderer_impl.h" 5 #include "media/filters/video_renderer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return; 214 return;
215 215
216 // Remain idle as long as we're not playing. 216 // Remain idle as long as we're not playing.
217 if (state_ != kPlaying || buffering_state_ != BUFFERING_HAVE_ENOUGH) { 217 if (state_ != kPlaying || buffering_state_ != BUFFERING_HAVE_ENOUGH) {
218 UpdateStatsAndWait_Locked(kIdleTimeDelta); 218 UpdateStatsAndWait_Locked(kIdleTimeDelta);
219 continue; 219 continue;
220 } 220 }
221 221
222 // Remain idle until we have the next frame ready for rendering. 222 // Remain idle until we have the next frame ready for rendering.
223 if (ready_frames_.empty()) { 223 if (ready_frames_.empty()) {
224 if (received_end_of_stream_ && !rendered_end_of_stream_) { 224 if (received_end_of_stream_) {
225 rendered_end_of_stream_ = true; 225 if (!rendered_end_of_stream_) {
226 ended_cb_.Run(); 226 rendered_end_of_stream_ = true;
227 ended_cb_.Run();
228 }
229 } else {
230 buffering_state_ = BUFFERING_HAVE_NOTHING;
231 task_runner_->PostTask(
232 FROM_HERE, base::Bind(buffering_state_cb_, BUFFERING_HAVE_NOTHING));
227 } 233 }
228 234
229 UpdateStatsAndWait_Locked(kIdleTimeDelta); 235 UpdateStatsAndWait_Locked(kIdleTimeDelta);
230 continue; 236 continue;
231 } 237 }
232 238
233 base::TimeDelta now = get_time_cb_.Run(); 239 base::TimeDelta now = get_time_cb_.Run();
234 base::TimeDelta target_paint_timestamp = ready_frames_.front()->timestamp(); 240 base::TimeDelta target_paint_timestamp = ready_frames_.front()->timestamp();
235 base::TimeDelta latest_paint_timestamp; 241 base::TimeDelta latest_paint_timestamp;
236 242
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 statistics_cb_.Run(statistics); 489 statistics_cb_.Run(statistics);
484 490
485 frames_decoded_ = 0; 491 frames_decoded_ = 0;
486 frames_dropped_ = 0; 492 frames_dropped_ = 0;
487 } 493 }
488 494
489 frame_available_.TimedWait(wait_duration); 495 frame_available_.TimedWait(wait_duration);
490 } 496 }
491 497
492 } // namespace media 498 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/video_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698