Index: media/base/pipeline.h |
diff --git a/media/base/pipeline.h b/media/base/pipeline.h |
index 7c79b3f41762b0810d33ad3c9fa740b1e8b15a86..e19c664cddc1143d85a3a698b764873306c6ff45 100644 |
--- a/media/base/pipeline.h |
+++ b/media/base/pipeline.h |
@@ -5,15 +5,11 @@ |
#ifndef MEDIA_BASE_PIPELINE_H_ |
#define MEDIA_BASE_PIPELINE_H_ |
-#include <string> |
- |
#include "base/gtest_prod_util.h" |
#include "base/memory/weak_ptr.h" |
-#include "base/synchronization/condition_variable.h" |
#include "base/synchronization/lock.h" |
#include "base/threading/thread_checker.h" |
#include "base/time/default_tick_clock.h" |
-#include "media/base/audio_renderer.h" |
#include "media/base/buffering_state.h" |
#include "media/base/demuxer.h" |
#include "media/base/media_export.h" |
@@ -32,11 +28,10 @@ namespace media { |
class FilterCollection; |
class MediaLog; |
+class Renderer; |
class TextRenderer; |
class TextTrackConfig; |
class TimeDeltaInterpolator; |
-class TimeSource; |
-class VideoRenderer; |
// Metadata describing a pipeline once it has been initialized. |
struct PipelineMetadata { |
@@ -178,9 +173,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
// Gets the current pipeline statistics. |
PipelineStatistics GetStatistics() const; |
- void set_underflow_disabled_for_testing(bool disabled) { |
- underflow_disabled_for_testing_ = disabled; |
- } |
+ void DisableUnderflowForTesting(); |
void SetTimeDeltaInterpolatorForTesting(TimeDeltaInterpolator* interpolator); |
scherkus (not reviewing)
2014/08/21 21:17:00
can this get removed and for existing tests they c
xhwang
2014/08/22 19:11:31
Good point. Done!
|
void SetErrorForTesting(PipelineStatus status); |
@@ -194,8 +187,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
enum State { |
kCreated, |
kInitDemuxer, |
- kInitAudioRenderer, |
- kInitVideoRenderer, |
+ kInitRenderer, |
kSeeking, |
kPlaying, |
kStopping, |
@@ -228,12 +220,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
// Callback executed by filters to update statistics. |
void OnUpdateStatistics(const PipelineStatistics& stats); |
- // Callback executed by audio renderer to update clock time. |
- void OnAudioTimeUpdate(base::TimeDelta time, base::TimeDelta max_time); |
- |
- // Callback executed by video renderer to update clock time. |
- void OnVideoTimeUpdate(base::TimeDelta max_time); |
- |
// The following "task" methods correspond to the public methods, but these |
// methods are run as the result of posting a task to the Pipeline's |
// task runner. |
@@ -256,8 +242,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb); |
// Callbacks executed when a renderer has ended. |
- void OnAudioRendererEnded(); |
- void OnVideoRendererEnded(); |
+ void OnRendererEnded(); |
void OnTextRendererEnded(); |
void RunEndedCallbackIfNeeded(); |
@@ -271,8 +256,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
// Kicks off initialization for each media object, executing |done_cb| with |
// the result when completed. |
void InitializeDemuxer(const PipelineStatusCB& done_cb); |
- void InitializeAudioRenderer(const PipelineStatusCB& done_cb); |
- void InitializeVideoRenderer(const PipelineStatusCB& done_cb); |
+ void InitializeRenderer(const PipelineStatusCB& done_cb); |
// Kicks off destroying filters. Called by StopTask() and ErrorChangedTask(). |
// When we start to tear down the pipeline, we will consider two cases: |
@@ -298,23 +282,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
void DoStop(const PipelineStatusCB& done_cb); |
void OnStopCompleted(PipelineStatus status); |
- // Collection of callback methods and helpers for tracking changes in |
- // buffering state and transition from paused/underflow states and playing |
- // states. |
- // |
- // While in the kPlaying state: |
- // - A waiting to non-waiting transition indicates preroll has completed |
- // and StartPlayback() should be called |
- // - A non-waiting to waiting transition indicates underflow has occurred |
- // and PausePlayback() should be called |
- void BufferingStateChanged(BufferingState* buffering_state, |
- BufferingState new_buffering_state); |
- bool WaitingForEnoughData() const; |
- void PausePlayback(); |
- void StartPlayback(); |
- |
- void PauseClockAndStopTicking_Locked(); |
- void StartClockIfWaitingForTimeUpdate_Locked(); |
+ void BufferingStateChanged(BufferingState new_buffering_state); |
// Task runner used to execute pipeline tasks. |
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
@@ -348,26 +316,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
// Current duration as reported by |demuxer_|. |
base::TimeDelta duration_; |
- // base::TickClock used by |interpolator_|. |
- base::DefaultTickClock default_tick_clock_; |
- |
- // Tracks the most recent media time update and provides interpolated values |
- // as playback progresses. |
- scoped_ptr<TimeDeltaInterpolator> interpolator_; |
- |
- enum InterpolationState { |
- // Audio (if present) is not rendering. Time isn't being interpolated. |
- INTERPOLATION_STOPPED, |
- |
- // Audio (if present) is rendering. Time isn't being interpolated. |
- INTERPOLATION_WAITING_FOR_AUDIO_TIME_UPDATE, |
- |
- // Audio (if present) is rendering. Time is being interpolated. |
- INTERPOLATION_STARTED, |
- }; |
- |
- InterpolationState interpolation_state_; |
- |
// Status of the pipeline. Initialized to PIPELINE_OK which indicates that |
// the pipeline is operating correctly. Any other value indicates that the |
// pipeline is stopped or is stopping. Clients can call the Stop() method to |
@@ -377,6 +325,8 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
// The following data members are only accessed by tasks posted to |
// |task_runner_|. |
+ bool is_initialized_; |
+ |
// Member that tracks the current state. |
State state_; |
@@ -384,12 +334,8 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
base::TimeDelta start_timestamp_; |
// Whether we've received the audio/video/text ended events. |
- bool audio_ended_; |
- bool video_ended_; |
- bool text_ended_; |
- |
- BufferingState audio_buffering_state_; |
- BufferingState video_buffering_state_; |
+ bool renderer_ended_; |
+ bool text_renderer_ended_; |
// Temporary callback used for Start() and Seek(). |
PipelineStatusCB seek_cb_; |
@@ -412,18 +358,15 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
// Holds the initialized renderers. Used for setting the volume, |
// playback rate, and determining when playback has finished. |
- scoped_ptr<AudioRenderer> audio_renderer_; |
- scoped_ptr<VideoRenderer> video_renderer_; |
+ scoped_ptr<Renderer> renderer_; |
scoped_ptr<TextRenderer> text_renderer_; |
- // Renderer-provided time source used to control playback. |
- TimeSource* time_source_; |
- |
PipelineStatistics statistics_; |
scoped_ptr<SerialRunner> pending_callbacks_; |
bool underflow_disabled_for_testing_; |
+ TimeDeltaInterpolator* test_interpolator_; |
base::ThreadChecker thread_checker_; |