diff options
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/filters.cc | 4 | ||||
-rw-r--r-- | media/base/filters.h | 10 | ||||
-rw-r--r-- | media/base/pipeline_impl.cc | 16 | ||||
-rw-r--r-- | media/base/pipeline_impl.h | 6 |
4 files changed, 27 insertions, 9 deletions
diff --git a/media/base/filters.cc b/media/base/filters.cc index ead0823..df7cfdf 100644 --- a/media/base/filters.cc +++ b/media/base/filters.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -79,6 +79,8 @@ bool VideoDecoder::HasAlpha() const { return false; } +void VideoDecoder::PrepareForShutdownHack() {} + AudioDecoder::AudioDecoder() {} AudioDecoder::~AudioDecoder() {} diff --git a/media/base/filters.h b/media/base/filters.h index adb6aff..8f186d6 100644 --- a/media/base/filters.h +++ b/media/base/filters.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -153,6 +153,14 @@ class MEDIA_EXPORT VideoDecoder : public Filter { // that return formats with an alpha channel. virtual bool HasAlpha() const; + // Prepare decoder for shutdown. This is a HACK needed because + // PipelineImpl::Stop() goes through a Pause/Flush/Stop dance to all its + // filters, waiting for each state transition to complete before starting the + // next, but WebMediaPlayerImpl::Destroy() holds the renderer loop hostage for + // the duration. Default implementation does nothing; derived decoders may + // override as needed. http://crbug.com/110228 tracks removing this. + virtual void PrepareForShutdownHack(); + protected: VideoDecoder(); virtual ~VideoDecoder(); diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc index e322299..320b133 100644 --- a/media/base/pipeline_impl.cc +++ b/media/base/pipeline_impl.cc @@ -130,7 +130,10 @@ void PipelineImpl::Stop(const PipelineStatusCB& stop_callback) { return; } - // Stop the pipeline, which will set |running_| to false on behalf. + if (video_decoder_) + video_decoder_->PrepareForShutdownHack(); + + // Stop the pipeline, which will set |running_| to false on our behalf. message_loop_->PostTask(FROM_HERE, base::Bind(&PipelineImpl::StopTask, this, stop_callback)); } @@ -1214,19 +1217,18 @@ bool PipelineImpl::InitializeVideoDecoder( return false; } - scoped_refptr<VideoDecoder> video_decoder; - filter_collection_->SelectVideoDecoder(&video_decoder); + filter_collection_->SelectVideoDecoder(&video_decoder_); - if (!video_decoder) { + if (!video_decoder_) { SetError(PIPELINE_ERROR_REQUIRED_FILTER_MISSING); return false; } - if (!PrepareFilter(video_decoder)) + if (!PrepareFilter(video_decoder_)) return false; - pipeline_init_state_->video_decoder_ = video_decoder; - video_decoder->Initialize( + pipeline_init_state_->video_decoder_ = video_decoder_; + video_decoder_->Initialize( stream, base::Bind(&PipelineImpl::OnFilterInitialize, this), base::Bind(&PipelineImpl::OnUpdateStatistics, this)); diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h index 36a9175..5b9ee4e 100644 --- a/media/base/pipeline_impl.h +++ b/media/base/pipeline_impl.h @@ -477,6 +477,12 @@ class MEDIA_EXPORT PipelineImpl // Reference to the filter(s) that constitute the pipeline. scoped_refptr<Filter> pipeline_filter_; + // Decoder reference used for signalling imminent shutdown. + // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the + // renderer thread loop hostage for until PipelineImpl::Stop() calls its + // callback. http://crbug.com/110228 tracks removing this hack. + scoped_refptr<VideoDecoder> video_decoder_; + // Renderer references used for setting the volume and determining // when playback has finished. scoped_refptr<AudioRenderer> audio_renderer_; |