summaryrefslogtreecommitdiffstats
path: root/media/base/pipeline_impl.h
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-11 02:41:16 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-11 02:41:16 +0000
commite37b706d4a28b85d4de081a4cf12fc66755d0ff9 (patch)
tree978607edaa975eaa17112b3a0dfcc6ebcbb3371a /media/base/pipeline_impl.h
parentfc2079586499395b20194bc160069b031835431e (diff)
downloadchromium_src-e37b706d4a28b85d4de081a4cf12fc66755d0ff9.zip
chromium_src-e37b706d4a28b85d4de081a4cf12fc66755d0ff9.tar.gz
chromium_src-e37b706d4a28b85d4de081a4cf12fc66755d0ff9.tar.bz2
More media::PipelineImpl cleanup, this time focusing on not taking down the render process.
Specifically, if the pipeline hasn't started we should fail gracefully and not DCHECK. Volume and playback rate are now allowed to be set if the pipeline isn't running, and filters will now receive a call to SetVolume() and SetPlaybackRate() with the initial values when the pipeline has fully initialized. Added tests and expectations for all of this and ran valgrind to verify that we were indeed leaking memory (now fixed). BUG=16009, 13902 TEST=media_unittests, layout tests Review URL: http://codereview.chromium.org/149500 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20455 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/pipeline_impl.h')
-rw-r--r--media/base/pipeline_impl.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index 2d6b988..911d253 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -73,7 +73,6 @@ class PipelineImpl : public Pipeline {
void SetBufferedBytes(int64 buffered_bytes);
void SetVideoSize(size_t width, size_t height);
void SetTime(base::TimeDelta time);
- void InternalSetPlaybackRate(float rate);
// Sets the error to the new error code only if the current error state is
// PIPELINE_OK. Returns true if error set, otherwise leaves current error
@@ -121,17 +120,14 @@ class PipelineImpl : public Pipeline {
size_t video_width_;
size_t video_height_;
- // Current volume level (from 0.0f to 1.0f). The volume reflects the last
- // value the audio filter was called with SetVolume, so there will be a short
- // period of time between the client calling SetVolume on the pipeline and
- // this value being updated. Set by the PipelineInternal just prior to
- // calling the audio renderer.
+ // Current volume level (from 0.0f to 1.0f). This value is set immediately
+ // via SetVolume() and a task is dispatched on the message loop to notify the
+ // filters.
float volume_;
- // Current playback rate (>= 0.0f). This member reflects the last value
- // that the filters in the pipeline were called with, so there will be a short
- // period of time between the client calling SetPlaybackRate and this value
- // being updated. Set by the PipelineInternal just prior to calling filters.
+ // Current playback rate (>= 0.0f). This value is set immediately via
+ // SetPlaybackRate() and a task is dispatched on the message loop to notify
+ // the filters.
float playback_rate_;
// Current playback time. Set by a FilterHostImpl object on behalf of the
@@ -187,8 +183,10 @@ class PipelineInternal : public base::RefCountedThreadSafe<PipelineInternal> {
PipelineCallback* start_callback);
void Stop(PipelineCallback* stop_callback);
void Seek(base::TimeDelta time, PipelineCallback* seek_callback);
- void SetPlaybackRate(float rate);
- void SetVolume(float volume);
+
+ // Notifies that the client has changed the playback rate/volume.
+ void PlaybackRateChanged(float playback_rate);
+ void VolumeChanged(float volume);
// Methods called by a FilterHostImpl object. These methods may be called
// on any thread, either the pipeline's thread or any other.
@@ -270,9 +268,12 @@ class PipelineInternal : public base::RefCountedThreadSafe<PipelineInternal> {
void StopTask(PipelineCallback* stop_callback);
void ErrorTask(PipelineError error);
- void SetPlaybackRateTask(float rate);
+ // Carries out notifying filters that the playback rate/volume has changed,
+ void PlaybackRateChangedTask(float playback_rate);
+ void VolumeChangedTask(float volume);
+
+ // Carries out notifying filters that we are seeking to a new timestamp.
void SeekTask(base::TimeDelta time, PipelineCallback* seek_callback);
- void SetVolumeTask(float volume);
// Internal methods used in the implementation of the pipeline thread. All
// of these methods are only called on the pipeline thread.