diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 07:13:58 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 07:13:58 +0000 |
commit | a8e24d5265840bb47aad860d987d015f195c6599 (patch) | |
tree | dd63c01c3af7a09b1b88605f1b3a8244facfd87b /webkit/glue/webmediaplayer_impl.cc | |
parent | 08d358276cfc2b4fda202598bef9f0eff053eb75 (diff) | |
download | chromium_src-a8e24d5265840bb47aad860d987d015f195c6599.zip chromium_src-a8e24d5265840bb47aad860d987d015f195c6599.tar.gz chromium_src-a8e24d5265840bb47aad860d987d015f195c6599.tar.bz2 |
Stopgap fix for crash in issue 53867 comment 15
gwtquake lets the renderer create > 300 threads (one per audio element?), and eventually thread creation fails. This CL makes the media code more robust against thread creation failure (currently, it just crashes the renderer).
The Real Fix probably is to have a thread pool for media stuff instead of one thread per media object. And maybe threads just leak under some circumstances. I will file a follow-up bug for that case, hopefully with a reduced test case.
BUG=53867,61293
TEST=Completing the first level in gwtquake shouldn't crash the renderer.
Review URL: http://codereview.chromium.org/5362003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webmediaplayer_impl.cc')
-rw-r--r-- | webkit/glue/webmediaplayer_impl.cc | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index bbf6172..58489cc 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -225,28 +225,32 @@ void WebMediaPlayerImpl::Proxy::PutCurrentFrame( WebMediaPlayerImpl::WebMediaPlayerImpl( WebKit::WebMediaPlayerClient* client, - media::MediaFilterCollection* collection, - MediaResourceLoaderBridgeFactory* bridge_factory_simple, - MediaResourceLoaderBridgeFactory* bridge_factory_buffered, - bool use_simple_data_source, - scoped_refptr<WebVideoRenderer> web_video_renderer) + media::MediaFilterCollection* collection) : network_state_(WebKit::WebMediaPlayer::Empty), ready_state_(WebKit::WebMediaPlayer::HaveNothing), main_loop_(NULL), filter_collection_(collection), + pipeline_(NULL), pipeline_thread_("PipelineThread"), paused_(true), playback_rate_(0.0f), client_(client), + proxy_(NULL), pipeline_stopped_(false, false) { // Saves the current message loop. DCHECK(!main_loop_); main_loop_ = MessageLoop::current(); +} +bool WebMediaPlayerImpl::Initialize( + MediaResourceLoaderBridgeFactory* bridge_factory_simple, + MediaResourceLoaderBridgeFactory* bridge_factory_buffered, + bool use_simple_data_source, + scoped_refptr<WebVideoRenderer> web_video_renderer) { // Create the pipeline and its thread. if (!pipeline_thread_.Start()) { NOTREACHED() << "Could not start PipelineThread"; - return; + return false; } pipeline_ = new media::PipelineImpl(pipeline_thread_.message_loop()); @@ -290,6 +294,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder()); filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder(NULL)); filter_collection_->AddAudioRenderer(new media::NullAudioRenderer()); + + return true; } WebMediaPlayerImpl::~WebMediaPlayerImpl() { @@ -776,10 +782,12 @@ void WebMediaPlayerImpl::Destroy() { // Make sure to kill the pipeline so there's no more media threads running. // Note: stopping the pipeline might block for a long time. - pipeline_->Stop(NewCallback(this, - &WebMediaPlayerImpl::PipelineStoppedCallback)); - pipeline_stopped_.Wait(); - pipeline_thread_.Stop(); + if (pipeline_) { + pipeline_->Stop(NewCallback(this, + &WebMediaPlayerImpl::PipelineStoppedCallback)); + pipeline_stopped_.Wait(); + pipeline_thread_.Stop(); + } // And then detach the proxy, it may live on the render thread for a little // longer until all the tasks are finished. |