Bug 1709130 - part2 : shutdown sink when seeking to next frame. r=bryce

For normal seeking operation, we would stop the sink first and restart sink if needed when MDSM enters `DecodingState` later.

We should also do that for seek-to-next-frame. After seeking completes, MDSM would reset the media time by the video keyframe's time, but the audio clock time might still behind because it doesn't skip to next keyframe (audio also doesn't have that concept).

We hit this issue in the `1709130.html` in the previous patch. After seeking completed, the media time (video next keyframe time) is updated but the audio clock time is still behind, so we hit the assertion in the `GetClock()` [1]

[1] https://searchfox.org/mozilla-central/rev/54097530955a98c768f2aaf56925578ec886ec77/dom/media/MediaDecoderStateMachine.cpp#3585

Depends on D114150

Differential Revision: https://phabricator.services.mozilla.com/D114151
This commit is contained in:
alwu 2021-05-05 16:50:34 +00:00
parent f73f4cee55
commit 1299cfd31c

View File

@ -1593,6 +1593,8 @@ class MediaDecoderStateMachine::NextFrameSeekingState
}
void DoSeek() override {
mMaster->StopMediaSink();
auto currentTime = mCurrentTime;
DiscardFrames(VideoQueue(), [currentTime](int64_t aSampleTime) {
return aSampleTime <= currentTime.ToMicroseconds();