| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 FFmpegVideoDecoder::~FFmpegVideoDecoder() { | 65 FFmpegVideoDecoder::~FFmpegVideoDecoder() { |
| 66 ReleaseFFmpegResources(); | 66 ReleaseFFmpegResources(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream, | 69 void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream, |
| 70 const PipelineStatusCB& pipeline_status_cb, | 70 const PipelineStatusCB& pipeline_status_cb, |
| 71 const StatisticsCB& statistics_cb) { | 71 const StatisticsCB& statistics_cb) { |
| 72 if (!message_loop_) { | 72 if (!message_loop_) { |
| 73 message_loop_ = message_loop_factory_cb_.Run(); | 73 message_loop_ = message_loop_factory_cb_.Run(); |
| 74 message_loop_factory_cb_.Reset(); | 74 message_loop_factory_cb_.Reset(); |
| 75 } else { | |
| 76 // TODO(scherkus): initialization currently happens more than once in | |
| 77 // PipelineIntegrationTest.BasicPlayback. | |
| 78 LOG(ERROR) << "Initialize has already been called."; | |
| 79 } | |
| 80 | 75 |
| 81 if (MessageLoop::current() != message_loop_) { | |
| 82 message_loop_->PostTask(FROM_HERE, base::Bind( | 76 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 83 &FFmpegVideoDecoder::Initialize, this, | 77 &FFmpegVideoDecoder::Initialize, this, |
| 84 make_scoped_refptr(demuxer_stream), pipeline_status_cb, statistics_cb)); | 78 make_scoped_refptr(demuxer_stream), pipeline_status_cb, statistics_cb)); |
| 85 return; | 79 return; |
| 86 } | 80 } |
| 87 | 81 |
| 82 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 88 DCHECK(!demuxer_stream_); | 83 DCHECK(!demuxer_stream_); |
| 89 | 84 |
| 90 if (!demuxer_stream) { | 85 if (!demuxer_stream) { |
| 91 pipeline_status_cb.Run(PIPELINE_ERROR_DECODE); | 86 pipeline_status_cb.Run(PIPELINE_ERROR_DECODE); |
| 92 return; | 87 return; |
| 93 } | 88 } |
| 94 | 89 |
| 95 demuxer_stream_ = demuxer_stream; | 90 demuxer_stream_ = demuxer_stream; |
| 96 statistics_cb_ = statistics_cb; | 91 statistics_cb_ = statistics_cb; |
| 97 | 92 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 scoped_refptr<VideoFrame> FFmpegVideoDecoder::AllocateVideoFrame() { | 442 scoped_refptr<VideoFrame> FFmpegVideoDecoder::AllocateVideoFrame() { |
| 448 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context_->pix_fmt); | 443 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context_->pix_fmt); |
| 449 size_t width = codec_context_->width; | 444 size_t width = codec_context_->width; |
| 450 size_t height = codec_context_->height; | 445 size_t height = codec_context_->height; |
| 451 | 446 |
| 452 return VideoFrame::CreateFrame(format, width, height, | 447 return VideoFrame::CreateFrame(format, width, height, |
| 453 kNoTimestamp(), kNoTimestamp()); | 448 kNoTimestamp(), kNoTimestamp()); |
| 454 } | 449 } |
| 455 | 450 |
| 456 } // namespace media | 451 } // namespace media |
| OLD | NEW |