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

Unified Diff: services/media/factory_service/media_player_impl.h

Issue 2085593002: Motown: Change player state machine to support preroll (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Make SetTimelineTransform calls more uniform with respect to other operations affecting the state m… Created 4 years, 6 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 | « no previous file | services/media/factory_service/media_player_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/media/factory_service/media_player_impl.h
diff --git a/services/media/factory_service/media_player_impl.h b/services/media/factory_service/media_player_impl.h
index 1f915e8839a63c50fb912e586c22c7b41db9e6eb..eabd01520890d5473bd10494f5fc9b2e9ebabf9e 100644
--- a/services/media/factory_service/media_player_impl.h
+++ b/services/media/factory_service/media_player_impl.h
@@ -51,8 +51,9 @@ class MediaPlayerImpl : public MediaFactoryService::Product<MediaPlayer>,
// Internal state.
enum class State {
kWaiting, // Waiting for some work to complete.
- kPaused,
- kPlaying,
+ kFlushed, // Paused with no data in the pipeline.
+ kPrimed, // Paused with data in the pipeline.
+ kPlaying, // Time is progressing.
};
struct Stream {
@@ -77,17 +78,6 @@ class MediaPlayerImpl : public MediaFactoryService::Product<MediaPlayer>,
// Takes action based on current state.
void Update();
- // Handles seeking in paused state.
- void WhenPausedAndSeeking();
-
- // Handles seeking in paused state with flushed pipeline.
- void WhenFlushedAndSeeking();
-
- // Sets the timeline transform. transform_subject_time_ is used for the
- // subject_time, and the effective_reference_time is now plus
- // kMinimumLeadTime.
- void SetTimelineTransform(uint32_t reference_delta, uint32_t subject_delta);
-
// Prepares a stream.
void PrepareStream(Stream* stream,
size_t index,
@@ -117,16 +107,33 @@ class MediaPlayerImpl : public MediaFactoryService::Product<MediaPlayer>,
MediaTimelineControlSitePtr timeline_control_site_;
TimelineConsumerPtr timeline_consumer_;
std::vector<std::unique_ptr<Stream>> streams_;
+
+ // The state we're currently in.
State state_ = State::kWaiting;
- State target_state_ = State::kPaused;
- bool flushed_ = true;
+
+ // The state we trying to transition to, either because the client has called
+ // |Play| or |Pause| or because we've hit end-of-stream.
+ State target_state_ = State::kFlushed;
+
+ // Whether we're currently at end-of-stream.
bool end_of_stream_ = false;
+
+ // The position we want to seek to (because the client called Seek) or
+ // kUnspecifiedTime, which indicates there's no desire to seek.
int64_t target_position_ = kUnspecifiedTime;
+
+ // The subject time to be used for SetTimelineTransform. The value is
+ // kUnspecifiedTime if there's no need to seek or the position we want to
+ // seek to if there is.
int64_t transform_subject_time_ = kUnspecifiedTime;
+
+ // A function that translates local time into presentation time in ns.
TimelineFunction timeline_function_;
+
CallbackJoiner set_transform_joiner_;
MediaMetadataPtr metadata_;
MojoPublisher<GetStatusCallback> status_publisher_;
+
// The following fields are just temporaries used to solve lambda capture
// problems.
InterfaceHandle<MediaRenderer> audio_renderer_;
« no previous file with comments | « no previous file | services/media/factory_service/media_player_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698