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

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 2631633003: [Video] Only start tracking foreground time if the video was resumed. (Closed)
Patch Set: Added a comment Created 3 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
« no previous file with comments | « media/blink/video_frame_compositor.cc ('k') | 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 edaeb353c4e1ea5d6c9cba3b272150b3dac22ae4..a4bb832bf62f861b2dac8c2440d88def0291da6d 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -300,9 +300,6 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
void SetReadyState(blink::WebMediaPlayer::ReadyState state);
- // Gets the duration value reported by the pipeline.
- double GetPipelineDuration() const;
-
// Returns the current video frame from |compositor_|. Blocks until the
// compositor can return the frame.
scoped_refptr<VideoFrame> GetCurrentFrameFromCompositor();
@@ -380,14 +377,19 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// is intended for android.
bool DoesOverlaySupportMetadata() const;
- // Whether the media should be paused when hidden. Uses metadata so has
+ // Whether the video should be paused when hidden. Uses metadata so has
// meaning only after the pipeline has started, otherwise returns false.
- bool ShouldPauseWhenHidden() const;
+ bool ShouldPauseVideoWhenHidden() const;
// Whether the video track should be disabled when hidden. Uses metadata so
// has meaning only after the pipeline has started, otherwise returns false.
bool ShouldDisableVideoWhenHidden() const;
+ // Whether the video is suitable for background playback optimizations (either
+ // pausing it or disabling the video track). Uses metadata so has meaning only
+ // after the pipeline has started, otherwise returns false.
+ bool IsBackgroundOptimizationCandidate() const;
+
// Disables the video track to save power if possible.
// Must be called when either of the following happens:
// - right after the video was hidden,
@@ -404,12 +406,23 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// - right after the pipeline has resumed if the video is not hidden.
void EnableVideoTrackIfNeeded();
- // Overrides the pipeline statistics returned by GetStatistics() for tests.
+ // Overrides the pipeline statistics returned by GetPiplineStatistics() for
+ // tests.
void SetPipelineStatisticsForTest(const PipelineStatistics& stats);
// Returns the pipeline statistics or the value overridden by tests.
PipelineStatistics GetPipelineStatistics() const;
+ // Overrides the pipeline media duration returned by
+ // GetPipelineMediaDuration() for tests.
+ void SetPipelineMediaDurationForTest(base::TimeDelta duration);
+
+ // Return the pipeline media duration or the value overridden by tests.
+ base::TimeDelta GetPipelineMediaDuration() const;
+
+ void ReportTimeFromForegroundToFirstFrame(base::TimeTicks foreground_time,
+ base::TimeTicks new_frame_time);
+
blink::WebLocalFrame* frame_;
// The playback state last reported to |delegate_|, to avoid setting duplicate
@@ -650,6 +663,9 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Pipeline statistics overridden by tests.
base::Optional<PipelineStatistics> pipeline_statistics_for_test_;
+ // Pipeline media duration overridden by tests.
+ base::Optional<base::TimeDelta> pipeline_media_duration_for_test_;
+
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
};
« no previous file with comments | « media/blink/video_frame_compositor.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698