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

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 1641423002: Re-land extract state management from WebMediaPlayerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WMPI fixes. Created 4 years, 11 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: media/blink/webmediaplayer_impl.h
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h
index ba03528cde0586e5ed147673922c16c0f41b3545..efd057eaca667fbfe8bd546a92fa3c6737c19c43 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -27,6 +27,7 @@
#include "media/blink/encrypted_media_player_support.h"
#include "media/blink/media_blink_export.h"
#include "media/blink/multibuffer_data_source.h"
+#include "media/blink/pipeline_state.h"
#include "media/blink/video_frame_compositor.h"
#include "media/blink/webmediaplayer_delegate.h"
#include "media/blink/webmediaplayer_params.h"
@@ -181,8 +182,6 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
blink::WebContentDecryptionModule* cdm,
blink::WebContentDecryptionModuleResult result) override;
- void OnPipelineSeeked(bool time_changed, PipelineStatus status);
- void OnPipelineSuspended(PipelineStatus status);
void OnPipelineEnded();
void OnPipelineError(PipelineStatus error);
void OnPipelineMetadata(PipelineMetadata metadata);
@@ -191,6 +190,9 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
void OnAddTextTrack(const TextTrackConfig& config,
const AddTextTrackDoneCB& done_cb);
+ void OnPipelineSeeked(bool time_updated);
+ void OnPipelineSuspended();
+
// WebMediaPlayerDelegate::Observer implementation.
void OnHidden() override;
void OnShown() override;
@@ -212,19 +214,7 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
#endif
private:
- // Ask for the pipeline to be suspended, will call Suspend() when ready.
- // (Possibly immediately.)
- void ScheduleSuspend();
-
- // Initiate suspending the pipeline.
- void Suspend();
-
- // Ask for the pipeline to be resumed, will call Resume() when ready.
- // (Possibly immediately.)
- void ScheduleResume();
-
- // Initiate resuming the pipeline.
- void Resume();
+ void DoSeek(base::TimeDelta time, bool time_updated);
// Called after |defer_load_cb_| has decided to allow the load. If
// |defer_load_cb_| is null this is called immediately.
@@ -280,10 +270,6 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Called when a CDM has been attached to the |pipeline_|.
void OnCdmAttached(bool success);
- // Updates |paused_time_| to the current media time with consideration for the
- // |ended_| state by clamping current time to duration upon |ended_|.
- void UpdatePausedTime();
-
// Notifies |delegate_| that playback has started or was paused; also starts
// or stops the memory usage reporting timer respectively.
void NotifyPlaybackStarted();
@@ -317,6 +303,7 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
scoped_refptr<base::TaskRunner> worker_task_runner_;
scoped_refptr<MediaLog> media_log_;
Pipeline pipeline_;
+ PipelineState pipeline_state_;
// The LoadType passed in the |load_type| parameter of the load() call.
LoadType load_type_;
@@ -340,44 +327,20 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// clock can creep forward a little bit while the asynchronous
// SetPlaybackRate(0) is being executed.
double playback_rate_;
+
+ // Set while paused. |paused_time_| is only valid when |paused_| is true.
bool paused_;
base::TimeDelta paused_time_;
- bool seeking_;
- // Set when seeking (|seeking_| is true) or resuming.
+ // Set when starting, seeking, and resuming (all of which require a Pipeline
+ // seek). |seek_time_| is only valid when |seeking_| is true.
+ bool seeking_;
base::TimeDelta seek_time_;
- // Set when a suspend is required but another suspend or seek is in progress.
- bool pending_suspend_;
-
- // Set when suspending immediately after a seek. The time change will happen
- // after Resume().
- bool pending_time_change_;
-
- // Set when a resume is required but suspending is in progress.
- bool pending_resume_;
-
- // Set for the entire period between suspend starting and resume completing.
- bool suspending_;
-
- // Set while suspending to detect double-suspend.
- bool suspended_;
-
- // Set while resuming to detect double-resume.
- bool resuming_;
-
// TODO(scherkus): Replace with an explicit ended signal to HTMLMediaElement,
// see http://crbug.com/409280
bool ended_;
- // Indicates that a seek is queued after the current seek completes or, if the
- // pipeline is suspended, after it resumes. Only the last queued seek will
- // have any effect.
- bool pending_seek_;
-
- // |pending_seek_time_| is meaningless when |pending_seek_| is false.
- base::TimeDelta pending_seek_time_;
-
// Tracks whether to issue time changed notifications during buffering state
// changes.
bool should_notify_time_changed_;

Powered by Google App Engine
This is Rietveld 408576698