| OLD | NEW |
| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 pts_stream_.EnqueuePts(buffer.get()); | 263 pts_stream_.EnqueuePts(buffer.get()); |
| 264 } | 264 } |
| 265 | 265 |
| 266 // Otherwise, attempt to decode a single frame. | 266 // Otherwise, attempt to decode a single frame. |
| 267 decode_engine_->ConsumeVideoSample(buffer); | 267 decode_engine_->ConsumeVideoSample(buffer); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void FFmpegVideoDecoder::ProduceVideoFrame( | 270 void FFmpegVideoDecoder::ProduceVideoFrame( |
| 271 scoped_refptr<VideoFrame> video_frame) { | 271 scoped_refptr<VideoFrame> video_frame) { |
| 272 if (MessageLoop::current() != message_loop_) { | 272 if (MessageLoop::current() != message_loop_) { |
| 273 message_loop_->PostTask( | 273 if (state_ != kStopped) { |
| 274 FROM_HERE, | 274 message_loop_->PostTask( |
| 275 NewRunnableMethod(this, | 275 FROM_HERE, |
| 276 &FFmpegVideoDecoder::ProduceVideoFrame, video_frame)); | 276 NewRunnableMethod(this, |
| 277 &FFmpegVideoDecoder::ProduceVideoFrame, |
| 278 video_frame)); |
| 279 } |
| 277 return; | 280 return; |
| 278 } | 281 } |
| 279 | 282 |
| 280 DCHECK_EQ(MessageLoop::current(), message_loop_); | 283 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 281 | 284 |
| 282 // Synchronized flushing before stop should prevent this. | 285 // Synchronized flushing before stop should prevent this. |
| 283 DCHECK_NE(state_, kStopped); | 286 DCHECK_NE(state_, kStopped); |
| 284 | 287 |
| 285 // If the decoding is finished, we just always return empty frames. | 288 // If the decoding is finished, we just always return empty frames. |
| 286 if (state_ == kDecodeFinished) { | 289 if (state_ == kDecodeFinished) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 decode_engine_->ProduceVideoFrame(video_frame); | 361 decode_engine_->ProduceVideoFrame(video_frame); |
| 359 } | 362 } |
| 360 } | 363 } |
| 361 | 364 |
| 362 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( | 365 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( |
| 363 VideoDecodeEngine* engine) { | 366 VideoDecodeEngine* engine) { |
| 364 decode_engine_.reset(engine); | 367 decode_engine_.reset(engine); |
| 365 } | 368 } |
| 366 | 369 |
| 367 } // namespace media | 370 } // namespace media |
| OLD | NEW |