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."; | |
acolwell GONE FROM CHROMIUM
2012/03/15 01:17:39
The comment is misleading and this LOG statement a
Ami GONE FROM CHROMIUM
2012/03/15 01:31:50
This code is even more messed up than that now tha
acolwell GONE FROM CHROMIUM
2012/03/15 13:55:16
Good point. Done.
| |
79 } | 75 } |
80 | 76 |
81 if (MessageLoop::current() != message_loop_) { | 77 if (MessageLoop::current() != message_loop_) { |
82 message_loop_->PostTask(FROM_HERE, base::Bind( | 78 message_loop_->PostTask(FROM_HERE, base::Bind( |
83 &FFmpegVideoDecoder::Initialize, this, | 79 &FFmpegVideoDecoder::Initialize, this, |
84 make_scoped_refptr(demuxer_stream), pipeline_status_cb, statistics_cb)); | 80 make_scoped_refptr(demuxer_stream), pipeline_status_cb, statistics_cb)); |
85 return; | 81 return; |
86 } | 82 } |
87 | 83 |
88 DCHECK(!demuxer_stream_); | 84 DCHECK(!demuxer_stream_); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 scoped_refptr<VideoFrame> FFmpegVideoDecoder::AllocateVideoFrame() { | 443 scoped_refptr<VideoFrame> FFmpegVideoDecoder::AllocateVideoFrame() { |
448 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context_->pix_fmt); | 444 VideoFrame::Format format = PixelFormatToVideoFormat(codec_context_->pix_fmt); |
449 size_t width = codec_context_->width; | 445 size_t width = codec_context_->width; |
450 size_t height = codec_context_->height; | 446 size_t height = codec_context_->height; |
451 | 447 |
452 return VideoFrame::CreateFrame(format, width, height, | 448 return VideoFrame::CreateFrame(format, width, height, |
453 kNoTimestamp(), kNoTimestamp()); | 449 kNoTimestamp(), kNoTimestamp()); |
454 } | 450 } |
455 | 451 |
456 } // namespace media | 452 } // namespace media |
OLD | NEW |