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

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

Issue 8686010: <video> decode in hardware! (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop INTRA/CONSTRAINED in profile, add missing 'virtual', add MEDIA_EXPORT, fix RemoveFilter loop Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/threading/platform_thread.h" 7 #include "base/threading/platform_thread.h"
8 #include "media/base/buffers.h" 8 #include "media/base/buffers.h"
9 #include "media/base/filter_host.h" 9 #include "media/base/filter_host.h"
10 #include "media/base/limits.h" 10 #include "media/base/limits.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Signal the subclass we're stopping. 90 // Signal the subclass we're stopping.
91 OnStop(callback); 91 OnStop(callback);
92 } 92 }
93 93
94 void VideoRendererBase::SetPlaybackRate(float playback_rate) { 94 void VideoRendererBase::SetPlaybackRate(float playback_rate) {
95 base::AutoLock auto_lock(lock_); 95 base::AutoLock auto_lock(lock_);
96 playback_rate_ = playback_rate; 96 playback_rate_ = playback_rate;
97 } 97 }
98 98
99 void VideoRendererBase::Seek(base::TimeDelta time, const FilterStatusCB& cb) { 99 void VideoRendererBase::Seek(base::TimeDelta time, const FilterStatusCB& cb) {
100 { 100 base::AutoLock auto_lock(lock_);
101 base::AutoLock auto_lock(lock_); 101 DCHECK_EQ(state_, kFlushed) << "Must flush prior to seeking.";
102 DCHECK_EQ(state_, kFlushed) << "Must flush prior to seeking."; 102 DCHECK(!cb.is_null());
103 DCHECK(!cb.is_null()); 103 DCHECK(seek_cb_.is_null());
104 DCHECK(seek_cb_.is_null());
105 104
106 state_ = kSeeking; 105 state_ = kSeeking;
107 seek_cb_ = cb; 106 seek_cb_ = cb;
108 seek_timestamp_ = time; 107 seek_timestamp_ = time;
109 AttemptRead_Locked(); 108 AttemptRead_Locked();
110 }
111 } 109 }
112 110
113 void VideoRendererBase::Initialize(VideoDecoder* decoder, 111 void VideoRendererBase::Initialize(VideoDecoder* decoder,
114 const base::Closure& callback, 112 const base::Closure& callback,
115 const StatisticsCallback& stats_callback) { 113 const StatisticsCallback& stats_callback) {
116 base::AutoLock auto_lock(lock_); 114 base::AutoLock auto_lock(lock_);
117 DCHECK(decoder); 115 DCHECK(decoder);
118 DCHECK(!callback.is_null()); 116 DCHECK(!callback.is_null());
119 DCHECK(!stats_callback.is_null()); 117 DCHECK(!stats_callback.is_null());
120 DCHECK_EQ(kUninitialized, state_); 118 DCHECK_EQ(kUninitialized, state_);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 267
270 // Still a chance we can render the frame! 268 // Still a chance we can render the frame!
271 if (remaining_time.InMicroseconds() > 0) 269 if (remaining_time.InMicroseconds() > 0)
272 break; 270 break;
273 271
274 // Frame dropped: read again. 272 // Frame dropped: read again.
275 ++frames_dropped; 273 ++frames_dropped;
276 frames_queue_ready_.pop_front(); 274 frames_queue_ready_.pop_front();
277 AttemptRead_Locked(); 275 AttemptRead_Locked();
278 } 276 }
279
280 // Continue waiting for the current paint to finish. 277 // Continue waiting for the current paint to finish.
281 continue; 278 continue;
282 } 279 }
283 280
284 // Congratulations! You've made it past the video frame timing gauntlet. 281 // Congratulations! You've made it past the video frame timing gauntlet.
285 // 282 //
286 // We can now safely update the current frame, request another frame, and 283 // We can now safely update the current frame, request another frame, and
287 // signal to the client that a new frame is available. 284 // signal to the client that a new frame is available.
288 DCHECK(!pending_paint_); 285 DCHECK(!pending_paint_);
289 DCHECK(!frames_queue_ready_.empty()); 286 DCHECK(!frames_queue_ready_.empty());
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 return base::TimeDelta::FromMicroseconds( 469 return base::TimeDelta::FromMicroseconds(
473 static_cast<int64>(sleep.InMicroseconds() / playback_rate)); 470 static_cast<int64>(sleep.InMicroseconds() / playback_rate));
474 } 471 }
475 472
476 void VideoRendererBase::DoStopOrError_Locked() { 473 void VideoRendererBase::DoStopOrError_Locked() {
477 DCHECK(!pending_paint_); 474 DCHECK(!pending_paint_);
478 DCHECK(!pending_paint_with_last_available_); 475 DCHECK(!pending_paint_with_last_available_);
479 lock_.AssertAcquired(); 476 lock_.AssertAcquired();
480 current_frame_ = NULL; 477 current_frame_ = NULL;
481 last_available_frame_ = NULL; 478 last_available_frame_ = NULL;
482 DCHECK(!pending_read_);
483 } 479 }
484 480
485 } // namespace media 481 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698