Chromium Code Reviews| Index: media/filters/ffmpeg_demuxer.cc |
| diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc |
| index 9429b0df3e4d27161a5affb1b5d11430aedd6b91..d6acd771c8a0586e0020a1d6192ad516e4151505 100644 |
| --- a/media/filters/ffmpeg_demuxer.cc |
| +++ b/media/filters/ffmpeg_demuxer.cc |
| @@ -276,10 +276,14 @@ base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( |
| // |
| // FFmpegDemuxer |
| // |
| -FFmpegDemuxer::FFmpegDemuxer(MessageLoop* message_loop, bool local_source) |
| +FFmpegDemuxer::FFmpegDemuxer( |
| + MessageLoop* message_loop, |
| + const scoped_refptr<DataSource>& data_source, |
| + bool local_source) |
| : message_loop_(message_loop), |
| local_source_(local_source), |
| format_context_(NULL), |
| + data_source_(data_source), |
| read_event_(false, false), |
| read_has_failed_(false), |
| last_read_bytes_(0), |
| @@ -290,6 +294,7 @@ FFmpegDemuxer::FFmpegDemuxer(MessageLoop* message_loop, bool local_source) |
| start_time_(kNoTimestamp()), |
| audio_disabled_(false) { |
| DCHECK(message_loop_); |
| + DCHECK(data_source_); |
| } |
| FFmpegDemuxer::~FFmpegDemuxer() { |
| @@ -336,8 +341,8 @@ void FFmpegDemuxer::OnAudioRendererDisabled() { |
| void FFmpegDemuxer::set_host(DemuxerHost* demuxer_host) { |
| Demuxer::set_host(demuxer_host); |
| - if (data_source_) |
| - data_source_->set_host(demuxer_host); |
| + data_source_->set_host(demuxer_host); |
| + |
| if (max_duration_.InMicroseconds() >= 0) |
|
acolwell GONE FROM CHROMIUM
2012/03/27 20:11:35
I think all the deferred calls below shouldn't be
scherkus (not reviewing)
2012/03/27 20:44:09
woah!
ended up cleaning this code up a bit more b
|
| host()->SetDuration(max_duration_); |
| if (read_position_ > 0) |
| @@ -346,12 +351,9 @@ void FFmpegDemuxer::set_host(DemuxerHost* demuxer_host) { |
| host()->OnDemuxerError(deferred_status_); |
| } |
| -void FFmpegDemuxer::Initialize(DataSource* data_source, |
| - const PipelineStatusCB& status_cb) { |
| - message_loop_->PostTask( |
| - FROM_HERE, |
| - base::Bind(&FFmpegDemuxer::InitializeTask, this, |
| - make_scoped_refptr(data_source), status_cb)); |
| +void FFmpegDemuxer::Initialize(const PipelineStatusCB& status_cb) { |
| + message_loop_->PostTask(FROM_HERE, base::Bind( |
| + &FFmpegDemuxer::InitializeTask, this, status_cb)); |
| } |
| scoped_refptr<DemuxerStream> FFmpegDemuxer::GetStream( |
| @@ -443,14 +445,9 @@ MessageLoop* FFmpegDemuxer::message_loop() { |
| return message_loop_; |
| } |
| -void FFmpegDemuxer::InitializeTask(DataSource* data_source, |
| - const PipelineStatusCB& status_cb) { |
| +void FFmpegDemuxer::InitializeTask(const PipelineStatusCB& status_cb) { |
| DCHECK_EQ(MessageLoop::current(), message_loop_); |
| - data_source_ = data_source; |
| - if (host()) |
| - data_source_->set_host(host()); |
| - |
| // Add ourself to Protocol list and get our unique key. |
| std::string key = FFmpegGlue::GetInstance()->AddProtocol(this); |