Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: media/base/pipeline.h

Issue 10796074: Move VideoRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: GetMediaTime Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/mock_filters.cc ('k') | media/base/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline.h
diff --git a/media/base/pipeline.h b/media/base/pipeline.h
index 2887965c999aa192cd2ea1893849738a85e54657..ce028be1be6b3f1102d4e126f68eaefa8a559d85 100644
--- a/media/base/pipeline.h
+++ b/media/base/pipeline.h
@@ -12,7 +12,6 @@
#include "base/synchronization/lock.h"
#include "media/base/audio_renderer.h"
#include "media/base/demuxer.h"
-#include "media/base/filter_host.h"
#include "media/base/media_export.h"
#include "media/base/pipeline_status.h"
#include "media/base/ranges.h"
@@ -29,7 +28,6 @@ namespace media {
class AudioDecoder;
class Clock;
-class Filter;
class FilterCollection;
class MediaLog;
class VideoDecoder;
@@ -82,7 +80,7 @@ class MEDIA_EXPORT PipelineStatusNotification {
// V Seek()/Stop() |
// [ Started ] -------------------------> [ Pausing (for each filter) ]
// | ^
-// | NotifyEnded() Seek()/Stop() |
+// | OnRendererEnded() Seek()/Stop() |
// `-------------> [ Ended ] ---------------------'
// ^ SetError()
// |
@@ -101,7 +99,6 @@ class MEDIA_EXPORT PipelineStatusNotification {
// "Stopped" state.
class MEDIA_EXPORT Pipeline
: public base::RefCountedThreadSafe<Pipeline>,
- public FilterHost,
public DemuxerHost {
public:
// Constructs a media pipeline that will execute on |message_loop|.
@@ -149,7 +146,7 @@ class MEDIA_EXPORT Pipeline
// Attempt to seek to the position specified by time. |seek_cb| will be
// executed when the all filters in the pipeline have processed the seek.
//
- // Clients are expected to call GetCurrentTime() to check whether the seek
+ // Clients are expected to call GetMediaTime() to check whether the seek
// succeeded.
//
// It is an error to call this method if the pipeline has not started.
@@ -194,9 +191,9 @@ class MEDIA_EXPORT Pipeline
// channels proportionately for multi-channel audio streams.
void SetVolume(float volume);
- // Gets the current pipeline time. For a pipeline "time" progresses from 0 to
- // the end of the media.
- base::TimeDelta GetCurrentTime() const;
+ // Returns the current media playback time, which progresses from 0 until
+ // GetMediaDuration().
+ base::TimeDelta GetMediaTime() const;
// Get approximate time ranges of buffered media.
Ranges<base::TimeDelta> GetBufferedTimeRanges();
@@ -226,6 +223,9 @@ class MEDIA_EXPORT Pipeline
private:
FRIEND_TEST_ALL_PREFIXES(PipelineTest, GetBufferedTimeRanges);
FRIEND_TEST_ALL_PREFIXES(PipelineTest, DisableAudioRenderer);
+ FRIEND_TEST_ALL_PREFIXES(PipelineTest, DisableAudioRendererDuringInit);
+ FRIEND_TEST_ALL_PREFIXES(PipelineTest, EndedCallback);
+ FRIEND_TEST_ALL_PREFIXES(PipelineTest, AudioStreamShorterThanVideo);
friend class MediaLog;
// Only allow ourselves to be deleted by reference counting.
@@ -296,12 +296,16 @@ class MEDIA_EXPORT Pipeline
virtual void SetDuration(base::TimeDelta duration) OVERRIDE;
virtual void OnDemuxerError(PipelineStatus error) OVERRIDE;
- // FilterHost implementation.
- virtual void SetError(PipelineStatus error) OVERRIDE;
- virtual base::TimeDelta GetTime() const OVERRIDE;
- virtual base::TimeDelta GetDuration() const OVERRIDE;
- virtual void SetNaturalVideoSize(const gfx::Size& size) OVERRIDE;
- virtual void NotifyEnded() OVERRIDE;
+ // Initiates teardown sequence in response to a runtime error.
+ //
+ // Safe to call from any thread.
+ void SetError(PipelineStatus error);
+
+ // Callback executed when the natural size of the video has changed.
+ void OnNaturalVideoSizeChanged(const gfx::Size& size);
+
+ // Callback executed when either of the renderers have ended.
+ void OnRendererEnded();
// Callbacks executed by filters upon completing initialization.
void OnFilterInitialize(PipelineStatus status);
@@ -358,8 +362,8 @@ class MEDIA_EXPORT Pipeline
// Carries out notifying filters that we are seeking to a new timestamp.
void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb);
- // Carries out handling a notification from a filter that it has ended.
- void NotifyEndedTask();
+ // Carries out handling a notification from a renderer that it has ended.
+ void OnRendererEndedTask();
// Carries out disabling the audio renderer.
void AudioDisabledTask();
@@ -406,10 +410,6 @@ class MEDIA_EXPORT Pipeline
// This will remove the race condition during stop between filters.
void TearDownPipeline();
- // Compute the current time. Assumes that the lock has been acquired by the
- // caller.
- base::TimeDelta GetCurrentTime_Locked() const;
-
// Compute the time corresponding to a byte offset.
base::TimeDelta TimeForByteOffset_Locked(int64 byte_offset) const;
@@ -536,13 +536,6 @@ class MEDIA_EXPORT Pipeline
PipelineStatusCB ended_cb_;
PipelineStatusCB error_cb_;
- // Reference to the filter(s) that constitute the pipeline.
- //
- // TODO(scherkus): At this point in time this is a CompositeFilter that
- // contains |video_renderer_|. Remove when CompositeFilter is gone, see
- // http://crbug.com/126069
- 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
« no previous file with comments | « media/base/mock_filters.cc ('k') | media/base/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698