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/callback.h" | 10 #include "base/callback.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 pts_stream_.EnqueuePts(buffer.get()); | 248 pts_stream_.EnqueuePts(buffer.get()); |
249 } | 249 } |
250 | 250 |
251 // Otherwise, attempt to decode a single frame. | 251 // Otherwise, attempt to decode a single frame. |
252 decode_engine_->ConsumeVideoSample(buffer); | 252 decode_engine_->ConsumeVideoSample(buffer); |
253 } | 253 } |
254 | 254 |
255 void FFmpegVideoDecoder::ProduceVideoFrame( | 255 void FFmpegVideoDecoder::ProduceVideoFrame( |
256 scoped_refptr<VideoFrame> video_frame) { | 256 scoped_refptr<VideoFrame> video_frame) { |
257 if (MessageLoop::current() != message_loop_) { | 257 if (MessageLoop::current() != message_loop_) { |
258 message_loop_->PostTask(FROM_HERE, base::Bind( | 258 if (state_ != kStopped) { |
259 &FFmpegVideoDecoder::ProduceVideoFrame, this, video_frame)); | 259 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 260 &FFmpegVideoDecoder::ProduceVideoFrame, this, video_frame)); |
| 261 } |
260 return; | 262 return; |
261 } | 263 } |
262 | 264 |
263 DCHECK_EQ(MessageLoop::current(), message_loop_); | 265 DCHECK_EQ(MessageLoop::current(), message_loop_); |
264 | 266 |
265 // Synchronized flushing before stop should prevent this. | 267 // Synchronized flushing before stop should prevent this. |
266 DCHECK_NE(state_, kStopped); | 268 DCHECK_NE(state_, kStopped); |
267 | 269 |
268 // If the decoding is finished, we just always return empty frames. | 270 // If the decoding is finished, we just always return empty frames. |
269 if (state_ == kDecodeFinished) { | 271 if (state_ == kDecodeFinished) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 decode_engine_->ProduceVideoFrame(video_frame); | 337 decode_engine_->ProduceVideoFrame(video_frame); |
336 } | 338 } |
337 } | 339 } |
338 | 340 |
339 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( | 341 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( |
340 VideoDecodeEngine* engine) { | 342 VideoDecodeEngine* engine) { |
341 decode_engine_.reset(engine); | 343 decode_engine_.reset(engine); |
342 } | 344 } |
343 | 345 |
344 } // namespace media | 346 } // namespace media |
OLD | NEW |