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

Issue 1160853006: Improve audio/video sync during underflow, reduce underflow frequency. (Closed)

Created:
5 years, 6 months ago by DaleCurtis
Modified:
5 years, 6 months ago
Reviewers:
xhwang
CC:
chromium-reviews, feature-media-reviews_chromium.org
Base URL:
http://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Improve audio/video sync during underflow, reduce underflow frequency. The current approach doesn't account for expired frames when resuming after underflow, which means we may resume and then immediately fail again; these frames are also out of sync with the audio playing out. Fixing this requires several changes to the pipeline: - TimeSource::ConvertMediaTimestamps() will now always convert timestamps, even when time is stopped. When time is stopped the converted values are based on the last known media wall clock time. - TimeSource::ConvertMediaTimestamps() will now return the current media wall clock time when an empty timestamps vector is given; this value is used to figure out which video frames have been played out already. - Introduce AudioClock::CompensateForSuspendedWrites() to ensure the audio delay value is correctly used when return the current wall clock time. - Introduce |was_time_moving_| to VideoRendererAlgorithm to ensure the |last_deadline_max_| value, used by RemoveExpiredFrames, is only changed when time is ticking; otherwise the value given to RemoveExpiredFrames is overwritten by Render() calls and EffectiveFramesQueued() will vary. - Modifies VideoRendererImpl::FrameReady() to remove expired frames based on the last known media wall clock time during underflow states. Combined these changes lead to a noticeable improvement in audio/video sync during underflow as well as a greatly reduced number of underflow events. BUG=498525 TEST=lots of new tests. Committed: https://crrev.com/8a047ffa05b477e148428c787e86601d21d73ce2 Cr-Commit-Position: refs/heads/master@{#333672}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Fix deadlock, wall clock source. #

Patch Set 3 : Docs. #

Patch Set 4 : Use current media time. #

Total comments: 6

Patch Set 5 : Rebase, fix, add tests. #

Total comments: 6

Patch Set 6 : Comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+438 lines, -103 lines) Patch
M media/base/time_source.h View 1 2 3 4 1 chunk +6 lines, -3 lines 0 comments Download
M media/base/wall_clock_time_source.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M media/base/wall_clock_time_source.cc View 1 2 3 4 chunks +24 lines, -19 lines 0 comments Download
M media/base/wall_clock_time_source_unittest.cc View 1 2 3 2 chunks +55 lines, -11 lines 0 comments Download
M media/filters/audio_clock.h View 1 2 3 1 chunk +12 lines, -0 lines 0 comments Download
M media/filters/audio_clock.cc View 1 2 3 4 3 chunks +19 lines, -2 lines 0 comments Download
M media/filters/audio_clock_unittest.cc View 1 2 3 4 1 chunk +26 lines, -0 lines 0 comments Download
M media/filters/video_renderer_algorithm.h View 1 2 3 4 5 4 chunks +12 lines, -4 lines 0 comments Download
M media/filters/video_renderer_algorithm.cc View 1 2 3 4 5 9 chunks +15 lines, -23 lines 0 comments Download
M media/filters/video_renderer_algorithm_unittest.cc View 1 2 3 4 5 5 chunks +38 lines, -0 lines 0 comments Download
M media/renderers/audio_renderer_impl.h View 1 2 3 4 3 chunks +6 lines, -1 line 0 comments Download
M media/renderers/audio_renderer_impl.cc View 1 2 3 4 4 chunks +47 lines, -23 lines 0 comments Download
M media/renderers/audio_renderer_impl_unittest.cc View 1 2 3 4 7 chunks +138 lines, -6 lines 0 comments Download
M media/renderers/video_renderer_impl.cc View 1 2 3 4 5 3 chunks +38 lines, -9 lines 0 comments Download

Messages

Total messages: 22 (7 generated)
DaleCurtis
Just for discussion right now, I think this is the right path forward, but need ...
5 years, 6 months ago (2015-06-03 02:23:34 UTC) #2
xhwang
I skimmed the code. Is the problem that during underflow, right after we EnqueueFrames(), we ...
5 years, 6 months ago (2015-06-03 22:19:47 UTC) #3
DaleCurtis
Thinking about this more, the core issue is that we want to expire frames which ...
5 years, 6 months ago (2015-06-04 16:47:51 UTC) #4
xhwang
On 2015/06/04 16:47:51, DaleCurtis wrote: > Thinking about this more, the core issue is that ...
5 years, 6 months ago (2015-06-04 20:21:05 UTC) #5
DaleCurtis
Updated to use current media time, still needs some more tests, but is in good ...
5 years, 6 months ago (2015-06-06 02:07:22 UTC) #6
DaleCurtis
Had to run last night before I could offer a summary. There are three issues ...
5 years, 6 months ago (2015-06-06 17:17:15 UTC) #7
xhwang
LG. This approach is much cleaner! I'll do another review after you finish all the ...
5 years, 6 months ago (2015-06-08 19:48:24 UTC) #8
DaleCurtis
Okay cleaned up and added tests for everything. I'm still running the numbers locally, but ...
5 years, 6 months ago (2015-06-09 02:17:40 UTC) #11
xhwang
lgtm, I only have a few nits. https://codereview.chromium.org/1160853006/diff/120001/media/filters/video_renderer_algorithm.cc File media/filters/video_renderer_algorithm.cc (right): https://codereview.chromium.org/1160853006/diff/120001/media/filters/video_renderer_algorithm.cc#newcode75 media/filters/video_renderer_algorithm.cc:75: was_time_moving_ = ...
5 years, 6 months ago (2015-06-09 22:26:00 UTC) #12
DaleCurtis
Thanks for review! https://codereview.chromium.org/1160853006/diff/120001/media/filters/video_renderer_algorithm.cc File media/filters/video_renderer_algorithm.cc (right): https://codereview.chromium.org/1160853006/diff/120001/media/filters/video_renderer_algorithm.cc#newcode75 media/filters/video_renderer_algorithm.cc:75: was_time_moving_ = UpdateFrameStatistics(); On 2015/06/09 22:26:00, ...
5 years, 6 months ago (2015-06-09 22:52:49 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1160853006/140001
5 years, 6 months ago (2015-06-09 22:56:00 UTC) #16
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_rel_ng/builds/31896)
5 years, 6 months ago (2015-06-10 00:31:33 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1160853006/140001
5 years, 6 months ago (2015-06-10 00:38:19 UTC) #20
commit-bot: I haz the power
Committed patchset #6 (id:140001)
5 years, 6 months ago (2015-06-10 03:18:06 UTC) #21
commit-bot: I haz the power
5 years, 6 months ago (2015-06-10 03:18:56 UTC) #22
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/8a047ffa05b477e148428c787e86601d21d73ce2
Cr-Commit-Position: refs/heads/master@{#333672}

Powered by Google App Engine
This is Rietveld 408576698