From edc181cd0f48ff6233cbefced5dcd2a02b2ab41c Mon Sep 17 00:00:00 2001 From: alwu Date: Wed, 21 Jul 2021 16:58:28 +0000 Subject: [PATCH] Bug 1717171 - only skip to next key frame when video decoding is too slow and later than the media time. r=bryce We should only seek to the next keyframe in a really bad situation where the video is way too slow and we probably already drop a lot of frames. Using the audio clock causes seeking to next key frame is too aggresively. That might happen even if only one video frame is late ,which is usually ignorable and won't cause any effect to users. So we should use the media time to perform such checking, not audio clock time. Differential Revision: https://phabricator.services.mozilla.com/D120418 --- dom/media/MediaDecoderStateMachine.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 2dbfacb621e3..b110a22012ab 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -592,9 +592,7 @@ class MediaDecoderStateMachine::DecodingState } void HandleVideoDecoded(VideoData* aVideo, TimeStamp aDecodeStart) override { - const auto currentTime = mMaster->mMediaSink->IsStarted() - ? mMaster->GetClock() - : mMaster->GetMediaTime(); + const auto currentTime = mMaster->GetMediaTime(); if (aVideo->GetEndTime() < currentTime) { SLOG("video %" PRId64 " is too late (current=%" PRId64 ")", aVideo->GetEndTime().ToMicroseconds(), currentTime.ToMicroseconds());