Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(840)

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 9968117: Move Demuxer::set_host() to Initialize(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 56db9177ce4a72cb096b686f7ba38b2c1e726df1..5576aaba037bb2de0ea345a62dd53c74ed90e489 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -280,7 +280,8 @@ FFmpegDemuxer::FFmpegDemuxer(
MessageLoop* message_loop,
const scoped_refptr<DataSource>& data_source,
bool local_source)
- : message_loop_(message_loop),
+ : host_(NULL),
+ message_loop_(message_loop),
local_source_(local_source),
format_context_(NULL),
data_source_(data_source),
@@ -338,14 +339,10 @@ void FFmpegDemuxer::OnAudioRendererDisabled() {
&FFmpegDemuxer::DisableAudioStreamTask, this));
}
-void FFmpegDemuxer::set_host(DemuxerHost* demuxer_host) {
- Demuxer::set_host(demuxer_host);
- data_source_->set_host(demuxer_host);
-}
-
-void FFmpegDemuxer::Initialize(const PipelineStatusCB& status_cb) {
+void FFmpegDemuxer::Initialize(DemuxerHost* host,
+ const PipelineStatusCB& status_cb) {
message_loop_->PostTask(FROM_HERE, base::Bind(
- &FFmpegDemuxer::InitializeTask, this, status_cb));
+ &FFmpegDemuxer::InitializeTask, this, host, status_cb));
}
scoped_refptr<DemuxerStream> FFmpegDemuxer::GetStream(
@@ -386,14 +383,14 @@ size_t FFmpegDemuxer::Read(size_t size, uint8* data) {
// let FFmpeg demuxer methods to run on.
int last_read_bytes = WaitForRead();
if (last_read_bytes == DataSource::kReadError) {
- host()->OnDemuxerError(PIPELINE_ERROR_READ);
+ host_->OnDemuxerError(PIPELINE_ERROR_READ);
// Returns with a negative number to signal an error to FFmpeg.
read_has_failed_ = true;
return AVERROR(EIO);
}
read_position_ += last_read_bytes;
- host()->SetCurrentReadPosition(read_position_);
+ host_->SetCurrentReadPosition(read_position_);
return last_read_bytes;
}
@@ -468,8 +465,11 @@ static int CalculateBitrate(
return bytes * 8000000.0 / duration_us;
}
-void FFmpegDemuxer::InitializeTask(const PipelineStatusCB& status_cb) {
+void FFmpegDemuxer::InitializeTask(DemuxerHost* host,
+ const PipelineStatusCB& status_cb) {
DCHECK_EQ(MessageLoop::current(), message_loop_);
+ host_ = host;
+ data_source_->set_host(host);
acolwell GONE FROM CHROMIUM 2012/04/04 16:01:00 This guy is next... ;)
scherkus (not reviewing) 2012/04/05 01:54:53 http://crbug.com/122071 added
// Add ourself to Protocol list and get our unique key.
std::string key = FFmpegGlue::GetInstance()->AddProtocol(this);
@@ -558,7 +558,7 @@ void FFmpegDemuxer::InitializeTask(const PipelineStatusCB& status_cb) {
// Good to go: set the duration and bitrate and notify we're done
// initializing.
- host()->SetDuration(max_duration);
+ host_->SetDuration(max_duration);
int64 filesize_in_bytes = 0;
GetSize(&filesize_in_bytes);

Powered by Google App Engine
This is Rietveld 408576698