Index: media/base/pipeline.h |
diff --git a/media/base/pipeline.h b/media/base/pipeline.h |
index c4de1ce1a346c1d22a38ebf42c6f5305bdd51b0a..1464cc2485952d766b3520000910dfd59071ff9c 100644 |
--- a/media/base/pipeline.h |
+++ b/media/base/pipeline.h |
@@ -13,6 +13,7 @@ |
#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" |
#include "media/base/pipeline_status.h" |
@@ -58,14 +59,13 @@ typedef base::Callback<void(PipelineMetadata)> PipelineMetadataCB; |
// [ InitXXX (for each filter) ] [ Stopping ] |
// | | |
// V V |
-// [ InitPreroll ] [ Stopped ] |
+// [ InitPrerolling ] [ Stopped ] |
// | |
// V |
-// [ Starting ] <-- [ Seeking ] |
+// [ Playing ] <-- [ Seeking ] |
// | ^ |
-// V | |
-// [ Started ] ----------' |
-// Seek() |
+// `---------------' |
+// Seek() |
// |
// Initialization is a series of state transitions from "Created" through each |
// filter initialization state. When all filter initialization states have |
@@ -194,8 +194,7 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
kInitVideoRenderer, |
kInitPrerolling, |
kSeeking, |
- kStarting, |
- kStarted, |
+ kPlaying, |
kStopping, |
kStopped, |
}; |
@@ -305,10 +304,6 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
// indepentent from seeking. |
void DoSeek(base::TimeDelta seek_timestamp, const PipelineStatusCB& done_cb); |
- // Updates playback rate and volume and initiates an asynchronous play call |
- // sequence executing |done_cb| with the final status when completed. |
- void DoPlay(const PipelineStatusCB& done_cb); |
- |
// Initiates an asynchronous pause-flush-stop call sequence executing |
// |done_cb| when completed. |
void DoStop(const PipelineStatusCB& done_cb); |
@@ -316,6 +311,21 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
void OnAudioUnderflow(); |
+ // 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 StartWaitingForEnoughData() should be called |
+ void BufferingStateChanged(BufferingState* buffering_state, |
+ BufferingState new_buffering_state); |
+ bool WaitingForEnoughData() const; |
+ void StartWaitingForEnoughData(); |
+ void StartPlayback(); |
+ |
void StartClockIfWaitingForTimeUpdate_Locked(); |
// Task runner used to execute pipeline tasks. |
@@ -377,6 +387,9 @@ class MEDIA_EXPORT Pipeline : public DemuxerHost { |
bool video_ended_; |
bool text_ended_; |
+ BufferingState audio_buffering_state_; |
+ BufferingState video_buffering_state_; |
+ |
// Temporary callback used for Start() and Seek(). |
PipelineStatusCB seek_cb_; |