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

Unified Diff: media/filters/video_renderer_algorithm.h

Issue 1160853006: Improve audio/video sync during underflow, reduce underflow frequency. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 5 years, 6 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/filters/audio_clock_unittest.cc ('k') | media/filters/video_renderer_algorithm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_algorithm.h
diff --git a/media/filters/video_renderer_algorithm.h b/media/filters/video_renderer_algorithm.h
index 4a3da250815eea1979e118259b823db737c9a934..71d251f416a667e9515afb779d776bdbbffba12d 100644
--- a/media/filters/video_renderer_algorithm.h
+++ b/media/filters/video_renderer_algorithm.h
@@ -117,6 +117,10 @@ class MEDIA_EXPORT VideoRendererAlgorithm {
// be counted as effective.
size_t EffectiveFramesQueued() const;
+ // Tells the algorithm that Render() callbacks have been suspended for a known
+ // reason and such stoppage shouldn't be counted against future frames.
+ void set_time_stopped() { was_time_moving_ = false; }
+
size_t frames_queued() const { return frame_queue_.size(); }
// Returns the average of the duration of all frames in |frame_queue_|
@@ -175,9 +179,8 @@ class MEDIA_EXPORT VideoRendererAlgorithm {
base::TimeTicks deadline_max);
// Updates the render count and wall clock timestamps for all frames in
- // |frame_queue_|. Returns false if statistics can't be updated at this time;
- // which occurs if media time has stopped or there are not enough frames to
- // calculate an average frame duration. Updates |cadence_estimator_|.
+ // |frame_queue_|. Updates |was_time_stopped_|, |cadence_estimator_| and
+ // |frame_duration_calculator_|.
//
// Note: Wall clock time is recomputed each Render() call because it's
// expected that the TimeSource powering TimeSource::WallClockTimeCB will skew
@@ -186,7 +189,7 @@ class MEDIA_EXPORT VideoRendererAlgorithm {
// TODO(dalecurtis): Investigate how accurate we need the wall clock times to
// be, so we can avoid recomputing every time (we would need to recompute when
// playback rate changes occur though).
- bool UpdateFrameStatistics();
+ void UpdateFrameStatistics();
// Updates the ideal render count for all frames in |frame_queue_| based on
// the cadence returned by |cadence_estimator_|. Cadence is assigned based
@@ -304,6 +307,11 @@ class MEDIA_EXPORT VideoRendererAlgorithm {
// by cadence in favor of one by drift or coverage.
bool last_render_ignored_cadence_frame_;
+ // Indicates if time was moving, set to the return value from
+ // UpdateFrameStatistics() during Render() or externally by
+ // set_time_stopped().
+ bool was_time_moving_;
+
DISALLOW_COPY_AND_ASSIGN(VideoRendererAlgorithm);
};
« no previous file with comments | « media/filters/audio_clock_unittest.cc ('k') | media/filters/video_renderer_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698