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

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 1830913005: Convert WMPI state management to level-triggered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix grammar. Created 4 years, 9 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 | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.h
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h
index fac56ed155e12fb134fabf55742bf12a0e55f46c..eec64fe7a55c1609aaee651ab10b1875210ce977 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -196,8 +196,16 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
void OnPipelineSeeked(bool time_updated);
private:
+ // Play states that are meaningful to |delegate_|.
+ // TODO(sandersd): This should move into WebMediaPlayerDelegate.
DaleCurtis 2016/03/25 23:21:23 Why not do it in this patch set then?
sandersd (OOO until July 31) 2016/03/25 23:42:42 The easy answer is that the Play state has additio
+ enum class PlayState {
+ GONE,
+ PLAYING,
+ PAUSED,
+ ENDED,
+ };
+
void OnPipelineSuspended();
- void OnPipelineResumed();
void OnPipelineEnded();
void OnPipelineError(PipelineStatus error);
void OnPipelineMetadata(PipelineMetadata metadata);
@@ -274,10 +282,16 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Called when a CDM has been attached to the |pipeline_|.
void OnCdmAttached(bool success);
- // Notifies |delegate_| that playback has started or was paused; also starts
- // or stops the memory usage reporting timer respectively.
- void NotifyPlaybackStarted();
- void NotifyPlaybackPaused();
+ // Inspectes the current playback state and:
+ // - notifies |delegate_|,
+ // - toggles the memory usage reporting timer, and
+ // - toggles suspend/resume as necessary.
+ // This method should be called any time its dependent variables are changed.
+ void UpdatePlayState();
+
+ // Internal to UpdatePlayState()
+ // TODO(sandersd): Move this into |delegate_|.
+ void UpdatePlayState_SetPlayState(PlayState new_state);
// Called at low frequency to tell external observers how much memory we're
// using for video playback. Called by |memory_usage_reporting_timer_|.
@@ -286,14 +300,21 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
void ReportMemoryUsage();
void FinishMemoryUsageReport(int64_t demuxer_memory_usage);
- // Indicates if automatic resumption of a suspended playback is allowed.
- bool IsAutomaticResumeAllowed();
-
blink::WebLocalFrame* frame_;
+ // The play state last reported to |delegate_|.
+ PlayState play_state_;
+
+ // Set when OnSuspendRequested() is called with |must_suspend| unset.
+ bool idle_suspend_;
+
+ // Set when OnSuspendRequested() is called with |must_suspend| set.
+ bool must_suspend_;
+
// TODO(hclam): get rid of these members and read from the pipeline directly.
blink::WebMediaPlayer::NetworkState network_state_;
blink::WebMediaPlayer::ReadyState ready_state_;
+ blink::WebMediaPlayer::ReadyState highest_ready_state_;
// Preload state for when |data_source_| is created after setPreload().
BufferedDataSource::Preload preload_;
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698