Chromium Code Reviews| Index: media/base/pipeline.cc |
| diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc |
| index 7f6efded12e69cd8ed38ae816662fc531c0d41a0..8742f3f125be2b6acb7d8452fce45c8b10e61be6 100644 |
| --- a/media/base/pipeline.cc |
| +++ b/media/base/pipeline.cc |
| @@ -84,8 +84,6 @@ Pipeline::Pipeline(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| clock_(new Clock(&base::Time::Now)), |
| waiting_for_clock_update_(false), |
| status_(PIPELINE_OK), |
| - has_audio_(false), |
| - has_video_(false), |
| state_(kCreated), |
| seek_timestamp_(kNoTimestamp()), |
| audio_ended_(false), |
| @@ -146,12 +144,12 @@ bool Pipeline::IsRunning() const { |
| bool Pipeline::HasAudio() const { |
| base::AutoLock auto_lock(lock_); |
| - return has_audio_; |
| + return audio_renderer_; |
| } |
| bool Pipeline::HasVideo() const { |
| base::AutoLock auto_lock(lock_); |
| - return has_video_; |
| + return video_renderer_; |
| } |
| float Pipeline::GetPlaybackRate() const { |
| @@ -356,7 +354,7 @@ void Pipeline::OnAudioTimeUpdate(TimeDelta time, TimeDelta max_time) { |
| DCHECK(IsRunning()); |
| base::AutoLock auto_lock(lock_); |
| - if (!has_audio_) |
| + if (!audio_renderer_) |
| return; |
| if (waiting_for_clock_update_ && time < clock_->Elapsed()) |
| return; |
| @@ -372,7 +370,7 @@ void Pipeline::OnVideoTimeUpdate(TimeDelta max_time) { |
| DCHECK(IsRunning()); |
| base::AutoLock auto_lock(lock_); |
| - if (has_audio_) |
| + if (audio_renderer_) |
| return; |
| if (state_ == kSeeking) |
| @@ -624,11 +622,8 @@ void Pipeline::InitializeTask(PipelineStatus last_stage_status) { |
| SetState(kInitAudioRenderer); |
| // Returns false if there's no audio stream. |
| - if (InitializeAudioRenderer(pipeline_init_state_->audio_decoder)) { |
| - base::AutoLock auto_lock(lock_); |
| - has_audio_ = true; |
| + if (InitializeAudioRenderer(pipeline_init_state_->audio_decoder)) |
| return; |
| - } |
| } |
| // Assuming audio renderer was created, create video renderer. |
| @@ -638,7 +633,6 @@ void Pipeline::InitializeTask(PipelineStatus last_stage_status) { |
| demuxer_->GetStream(DemuxerStream::VIDEO); |
| if (InitializeVideoRenderer(video_stream)) { |
| base::AutoLock auto_lock(lock_); |
| - has_video_ = true; |
| // Get an initial natural size so we have something when we signal |
| // the kHaveMetadata buffering state. |
| @@ -671,7 +665,10 @@ void Pipeline::InitializeTask(PipelineStatus last_stage_status) { |
| seek_timestamp_ = demuxer_->GetStartTime(); |
| DoSeek(seek_timestamp_, true, |
| base::Bind(&Pipeline::OnFilterStateTransition, this)); |
| + return; |
| } |
| + |
| + NOTREACHED() << "Unexpected state: " << state_; |
|
Ami GONE FROM CHROMIUM
2012/08/30 07:09:10
Added b/c otherwise the control structures in this
|
| } |
| // This method is called as a result of the client calling Pipeline::Stop() or |
| @@ -863,7 +860,7 @@ void Pipeline::AudioDisabledTask() { |
| DCHECK(message_loop_->BelongsToCurrentThread()); |
| base::AutoLock auto_lock(lock_); |
| - has_audio_ = false; |
| + audio_renderer_ = NULL; |
| audio_disabled_ = true; |
| // Notify our demuxer that we're no longer rendering audio. |
| @@ -941,7 +938,7 @@ void Pipeline::FilterStateTransitionTask() { |
| // We use audio stream to update the clock. So if there is such a stream, |
| // we pause the clock until we receive a valid timestamp. |
| waiting_for_clock_update_ = true; |
| - if (!has_audio_) { |
| + if (!audio_renderer_) { |
| clock_->SetMaxTime(clock_->Duration()); |
| StartClockIfWaitingForTimeUpdate_Locked(); |
| } |