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

Unified Diff: examples/media_test/media_test.cc

Issue 2006093004: Motown: Convert MediaSink to expose MediaTimelineControlSite (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
Index: examples/media_test/media_test.cc
diff --git a/examples/media_test/media_test.cc b/examples/media_test/media_test.cc
index c1f0d19122e4ff1dabbe3b010ff5e9ec0e87670e..5d760040037d167107baab5c997b05b8cad7560d 100644
--- a/examples/media_test/media_test.cc
+++ b/examples/media_test/media_test.cc
@@ -20,8 +20,7 @@ std::unique_ptr<MediaTest> MediaTest::Create(
}
MediaTest::MediaTest(mojo::ApplicationImpl* app,
- const std::string& input_file_name)
- : state_(MediaState::UNPREPARED) {
+ const std::string& input_file_name) {
MediaFactoryPtr factory;
ConnectToService(app->shell(), "mojo:media_factory", GetProxy(&factory));
@@ -57,13 +56,19 @@ void MediaTest::HandleStatusUpdates(uint64_t version,
MediaPlayerStatusPtr status) {
if (status) {
// Process status received from the player.
- previous_state_ = state_;
- state_ = status->state;
-
if (status->timeline_transform) {
timeline_function_ = status->timeline_transform.To<TimelineFunction>();
}
+ previous_state_ = state_;
+ if (status->end_of_stream) {
+ state_ = State::kEnded;
+ } else if (timeline_function_.subject_delta() == 0) {
+ state_ = State::kPaused;
+ } else {
+ state_ = State::kPlaying;
+ }
+
metadata_ = status->metadata.Pass();
if (update_callback_ != nullptr) {

Powered by Google App Engine
This is Rietveld 408576698