diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 17:26:44 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-26 17:26:44 +0000 |
commit | 9668838dea335d279409c621ede1730624acf7af (patch) | |
tree | 435adb270d282dce74e4d1e0bd7cb309ab9553a4 /media | |
parent | e457b150e965030f9a032ebc24292f2014631441 (diff) | |
download | chromium_src-9668838dea335d279409c621ede1730624acf7af.zip chromium_src-9668838dea335d279409c621ede1730624acf7af.tar.gz chromium_src-9668838dea335d279409c621ede1730624acf7af.tar.bz2 |
Micro-refactor: added VideoRendererBase::OnStop().
Updated subclasses WtlRenderer and VideoRendererImpl as well.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/147191
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/video_renderer_base.cc | 7 | ||||
-rw-r--r-- | media/filters/video_renderer_base.h | 5 | ||||
-rw-r--r-- | media/player/wtl_renderer.cc | 3 | ||||
-rw-r--r-- | media/player/wtl_renderer.h | 2 |
4 files changed, 17 insertions, 0 deletions
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc index 4a5c0b5..2a9ba66 100644 --- a/media/filters/video_renderer_base.cc +++ b/media/filters/video_renderer_base.cc @@ -57,6 +57,13 @@ bool VideoRendererBase::ParseMediaFormat(const MediaFormat& media_format, void VideoRendererBase::Stop() { AutoLock auto_lock(lock_); state_ = STOPPED; + + // Signal the subclass we're stopping. + // TODO(scherkus): do we trust subclasses not to do something silly while + // we're holding the lock? + OnStop(); + + // Clean up our thread if present. if (thread_) { // Signal the thread since it's possible to get stopped with the video // thread waiting for a read to complete. diff --git a/media/filters/video_renderer_base.h b/media/filters/video_renderer_base.h index 7e0868b..e71befa 100644 --- a/media/filters/video_renderer_base.h +++ b/media/filters/video_renderer_base.h @@ -59,6 +59,11 @@ class VideoRendererBase : public VideoRenderer, // output surfaces. Implementors should NOT call InitializationComplete(). virtual bool OnInitialize(VideoDecoder* decoder) = 0; + // Subclass interface. Called before any other stopping actions takes place. + // + // Implementors should perform any necessary cleanup before returning. + virtual void OnStop() = 0; + // Subclass interface. Called when a new frame is ready for display, which // can be accessed via GetCurrentFrame(). // diff --git a/media/player/wtl_renderer.cc b/media/player/wtl_renderer.cc index 45b380b..f7d87fa 100644 --- a/media/player/wtl_renderer.cc +++ b/media/player/wtl_renderer.cc @@ -20,6 +20,9 @@ bool WtlVideoRenderer::IsMediaFormatSupported( return ParseMediaFormat(media_format, &width, &height); } +void WtlVideoRenderer::OnStop() { +} + bool WtlVideoRenderer::OnInitialize(media::VideoDecoder* decoder) { int width = 0; int height = 0; diff --git a/media/player/wtl_renderer.h b/media/player/wtl_renderer.h index eba1fc8..23f1b2a 100644 --- a/media/player/wtl_renderer.h +++ b/media/player/wtl_renderer.h @@ -18,7 +18,9 @@ class WtlVideoRenderer : public media::VideoRendererBase { static bool IsMediaFormatSupported(const media::MediaFormat& media_format); protected: + // VideoRendererBase implementation. virtual bool OnInitialize(media::VideoDecoder* decoder); + virtual void OnStop(); virtual void OnFrameAvailable(); private: |