From e0111a1986e2bc833ec44e789a9b319eb7986c58 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Mon, 6 Apr 2009 23:10:42 +0000 Subject: Detach media filters from WebMediaPlayerDelegateImpl During stopping of the media pipeline in chrome, we need to detach the filters from WebMediaPlayerDelegateImpl so it doesn't hold renferences to the filters and filters can be destructed by the pipeline. Review URL: http://codereview.chromium.org/60113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13204 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/media/audio_renderer_impl.cc | 1 + chrome/renderer/media/data_source_impl.cc | 3 +++ chrome/renderer/media/video_renderer_impl.cc | 4 ++++ chrome/renderer/media/video_renderer_impl.h | 3 +++ 4 files changed, 11 insertions(+) (limited to 'chrome/renderer/media') diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc index 9276b0e..a0b6ae3 100644 --- a/chrome/renderer/media/audio_renderer_impl.cc +++ b/chrome/renderer/media/audio_renderer_impl.cc @@ -55,6 +55,7 @@ bool AudioRendererImpl::OnInitialize(const media::MediaFormat& media_format) { } void AudioRendererImpl::OnStop() { + delegate_->SetAudioRenderer(NULL); if (!resource_release_event_.IsSignaled()) { render_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, diff --git a/chrome/renderer/media/data_source_impl.cc b/chrome/renderer/media/data_source_impl.cc index 65a725f..9ee3331 100644 --- a/chrome/renderer/media/data_source_impl.cc +++ b/chrome/renderer/media/data_source_impl.cc @@ -45,6 +45,8 @@ void DataSourceImpl::Stop() { return; stopped_ = true; + delegate_->SetDataSource(NULL); + // Wakes up demuxer waiting on |read_event_| in Read(). read_event_.Signal(); // Wakes up demuxer waiting on |seek_event_| in SetPosition(). @@ -226,6 +228,7 @@ void DataSourceImpl::ReleaseResources(bool render_thread_is_dying) { resource_loader_bridge_ = NULL; } else if (resource_loader_bridge_) { resource_loader_bridge_->Cancel(); + delete resource_loader_bridge_; resource_loader_bridge_ = NULL; } resource_release_event_.Signal(); diff --git a/chrome/renderer/media/video_renderer_impl.cc b/chrome/renderer/media/video_renderer_impl.cc index 542959f..ed1704f 100644 --- a/chrome/renderer/media/video_renderer_impl.cc +++ b/chrome/renderer/media/video_renderer_impl.cc @@ -13,6 +13,10 @@ VideoRendererImpl::VideoRendererImpl(WebMediaPlayerDelegateImpl* delegate) delegate_->SetVideoRenderer(this); } +void VideoRendererImpl::OnStop() { + delegate_->SetVideoRenderer(NULL); +} + bool VideoRendererImpl::OnInitialize(size_t width, size_t height) { video_size_.SetSize(width, height); bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height); diff --git a/chrome/renderer/media/video_renderer_impl.h b/chrome/renderer/media/video_renderer_impl.h index 963b862..01ded10 100644 --- a/chrome/renderer/media/video_renderer_impl.h +++ b/chrome/renderer/media/video_renderer_impl.h @@ -49,6 +49,9 @@ class VideoRendererImpl : public media::VideoRendererBase { // Method called by base class during initialization. virtual bool OnInitialize(size_t width, size_t height); + // Method called by VideoRendererBase to tell us to stop. + virtual void OnStop(); + // Method called by the VideoRendererBase when a repaint is needed. virtual void OnPaintNeeded(); -- cgit v1.1