| Index: media/blink/webmediaplayer_impl.h
|
| diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h
|
| index fac56ed155e12fb134fabf55742bf12a0e55f46c..87998a086e1969587d7010f613b6d02636ace524 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.
|
| + 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();
|
| + // Inspects 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_;
|
|
|