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

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

Issue 6969026: Convert Filter::Seek() to use new callback system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More CR fixes Created 9 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/ffmpeg_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_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 (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 "media/filters/ffmpeg_video_decoder.h" 5 #include "media/filters/ffmpeg_video_decoder.h"
6 6
7 #include <deque> 7 #include <deque>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 AutoCallbackRunner done_runner(flush_callback_.release()); 177 AutoCallbackRunner done_runner(flush_callback_.release());
178 178
179 // Everything in the presentation time queue is invalid, clear the queue. 179 // Everything in the presentation time queue is invalid, clear the queue.
180 pts_stream_.Flush(); 180 pts_stream_.Flush();
181 181
182 // Mark flush operation had been done. 182 // Mark flush operation had been done.
183 state_ = kNormal; 183 state_ = kNormal;
184 } 184 }
185 185
186 void FFmpegVideoDecoder::Seek(base::TimeDelta time, 186 void FFmpegVideoDecoder::Seek(base::TimeDelta time, const FilterStatusCB& cb) {
187 FilterCallback* callback) {
188 if (MessageLoop::current() != message_loop_) { 187 if (MessageLoop::current() != message_loop_) {
189 message_loop_->PostTask(FROM_HERE, 188 message_loop_->PostTask(FROM_HERE,
190 NewRunnableMethod(this, 189 NewRunnableMethod(this, &FFmpegVideoDecoder::Seek,
191 &FFmpegVideoDecoder::Seek, 190 time, cb));
192 time,
193 callback));
194 return; 191 return;
195 } 192 }
196 193
197 DCHECK_EQ(MessageLoop::current(), message_loop_); 194 DCHECK_EQ(MessageLoop::current(), message_loop_);
198 DCHECK(!seek_callback_.get()); 195 DCHECK(seek_cb_.is_null());
199 196
200 pts_stream_.Seek(time); 197 pts_stream_.Seek(time);
201 seek_callback_.reset(callback); 198 seek_cb_ = cb;
202 decode_engine_->Seek(); 199 decode_engine_->Seek();
203 } 200 }
204 201
205 void FFmpegVideoDecoder::OnSeekComplete() { 202 void FFmpegVideoDecoder::OnSeekComplete() {
206 DCHECK_EQ(MessageLoop::current(), message_loop_); 203 DCHECK_EQ(MessageLoop::current(), message_loop_);
207 DCHECK(seek_callback_.get()); 204 DCHECK(!seek_cb_.is_null());
208 205
209 AutoCallbackRunner done_runner(seek_callback_.release()); 206 ResetAndRunCB(&seek_cb_, PIPELINE_OK);
210 } 207 }
211 208
212 void FFmpegVideoDecoder::OnError() { 209 void FFmpegVideoDecoder::OnError() {
213 VideoFrameReady(NULL); 210 VideoFrameReady(NULL);
214 } 211 }
215 212
216 void FFmpegVideoDecoder::OnFormatChange(VideoStreamInfo stream_info) { 213 void FFmpegVideoDecoder::OnFormatChange(VideoStreamInfo stream_info) {
217 NOTIMPLEMENTED(); 214 NOTIMPLEMENTED();
218 } 215 }
219 216
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 VideoFrameReady(video_frame); 369 VideoFrameReady(video_frame);
373 } 370 }
374 } 371 }
375 372
376 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( 373 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest(
377 VideoDecodeEngine* engine) { 374 VideoDecodeEngine* engine) {
378 decode_engine_.reset(engine); 375 decode_engine_.reset(engine);
379 } 376 }
380 377
381 } // namespace media 378 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_video_decoder.h ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698