| Index: media/filters/ffmpeg_video_decoder.cc
|
| diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
|
| index b7da7f7a462d17f15fe57d6e2e7e193b46dfef98..073fb57a92ea30f672414343faec367c19fc6a25 100644
|
| --- a/media/filters/ffmpeg_video_decoder.cc
|
| +++ b/media/filters/ffmpeg_video_decoder.cc
|
| @@ -75,7 +75,7 @@ static size_t RoundUp(size_t value, size_t alignment) {
|
| FFmpegVideoDecoder::FFmpegVideoDecoder(
|
| const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
|
| : task_runner_(task_runner), state_(kUninitialized),
|
| - decode_nalus_(false) {}
|
| + decode_nalus_(false), weak_factory_(this) {}
|
|
|
| int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
|
| AVFrame* frame,
|
| @@ -153,6 +153,7 @@ void FFmpegVideoDecoder::Initialize(const VideoDecoderConfig& config,
|
| bool low_delay,
|
| const PipelineStatusCB& status_cb,
|
| const OutputCB& output_cb) {
|
| + DVLOG(2) << __FUNCTION__;
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
| DCHECK(!config.is_encrypted());
|
| DCHECK(!output_cb.is_null());
|
| @@ -176,6 +177,29 @@ void FFmpegVideoDecoder::Initialize(const VideoDecoderConfig& config,
|
|
|
| void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
|
| const DecodeCB& decode_cb) {
|
| + DVLOG(2) << __FUNCTION__;
|
| + DCHECK(task_runner_->BelongsToCurrentThread());
|
| +
|
| + static int count = 1;
|
| + count++;
|
| + int delay = 1;
|
| + if (count % 100 == 0)
|
| + delay = 2000;
|
| +
|
| + //base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(delay));
|
| + //DecodeInternal(buffer, decode_cb);
|
| +
|
| + task_runner_->PostDelayedTask(FROM_HERE,
|
| + base::Bind(&FFmpegVideoDecoder::DecodeInternal,
|
| + weak_factory_.GetWeakPtr(),
|
| + buffer,
|
| + decode_cb),
|
| + base::TimeDelta::FromMilliseconds(delay));
|
| +}
|
| +
|
| +void FFmpegVideoDecoder::DecodeInternal(const scoped_refptr<DecoderBuffer>& buffer,
|
| + const DecodeCB& decode_cb) {
|
| + DVLOG(2) << __FUNCTION__;
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
| DCHECK(buffer);
|
| DCHECK(!decode_cb.is_null());
|
| @@ -193,6 +217,8 @@ void FFmpegVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
|
| return;
|
| }
|
|
|
| + //base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(40));
|
| +
|
| DCHECK_EQ(state_, kNormal);
|
|
|
| // During decode, because reads are issued asynchronously, it is possible to
|
| @@ -308,6 +334,7 @@ bool FFmpegVideoDecoder::FFmpegDecode(
|
| frame->set_timestamp(
|
| base::TimeDelta::FromMicroseconds(av_frame_->reordered_opaque));
|
| *has_produced_frame = true;
|
| +
|
| output_cb_.Run(frame);
|
|
|
| av_frame_unref(av_frame_.get());
|
|
|