DescriptionImprove 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. #
Messages
Total messages: 22 (7 generated)
|