| Index: media/base/pipeline.h
|
| diff --git a/media/base/pipeline.h b/media/base/pipeline.h
|
| index 9bfa7857a9522455d1e7960d6b3c4e439d15e677..cff1fa35995b09e62fdbe74156ac0f892ca0e08a 100644
|
| --- a/media/base/pipeline.h
|
| +++ b/media/base/pipeline.h
|
| @@ -5,14 +5,10 @@
|
| #ifndef MEDIA_BASE_PIPELINE_H_
|
| #define MEDIA_BASE_PIPELINE_H_
|
|
|
| -#include <string>
|
| -
|
| #include "base/gtest_prod_util.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"
|
| @@ -31,11 +27,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 {
|
| @@ -177,9 +172,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);
|
| void SetErrorForTesting(PipelineStatus status);
|
|
|
| @@ -193,8 +186,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| enum State {
|
| kCreated,
|
| kInitDemuxer,
|
| - kInitAudioRenderer,
|
| - kInitVideoRenderer,
|
| + kInitRenderer,
|
| kSeeking,
|
| kPlaying,
|
| kStopping,
|
| @@ -226,19 +218,12 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| void SetError(PipelineStatus error);
|
|
|
| // Callbacks executed when a renderer has ended.
|
| - void OnAudioRendererEnded();
|
| - void OnVideoRendererEnded();
|
| + void OnRendererEnded();
|
| void OnTextRendererEnded();
|
|
|
| // 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.
|
| @@ -261,9 +246,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost {
|
| void SeekTask(base::TimeDelta time, const PipelineStatusCB& seek_cb);
|
|
|
| // Handles audio/video/text ended logic and running |ended_cb_|.
|
| - void DoAudioRendererEnded();
|
| - void DoVideoRendererEnded();
|
| - void DoTextRendererEnded();
|
| void RunEndedCallbackIfNeeded();
|
|
|
| // Carries out adding a new text stream to the text renderer.
|
| @@ -276,8 +258,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:
|
| @@ -303,23 +284,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_;
|
| @@ -353,26 +318,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
|
| @@ -382,6 +327,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_;
|
|
|
| @@ -389,13 +336,9 @@ 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 ended_;
|
| bool text_ended_;
|
|
|
| - BufferingState audio_buffering_state_;
|
| - BufferingState video_buffering_state_;
|
| -
|
| // Temporary callback used for Start() and Seek().
|
| PipelineStatusCB seek_cb_;
|
|
|
| @@ -417,18 +360,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_;
|
|
|
|
|