Bug 1847286 - make the interval start time to audio's base. r=media-playback-reviewers,azebrowski

The base of seek target is 1,000,000 us (set from JS, in second)
but the audio base is usually 44100 or 48000 (or other). I'm guessing
there probably are rounding errors which cause incorrect frame
conversion then hit the assertion [1].

So we should make the interval in the audio base in the beginning before
doing any calculation.

[1] https://hg.mozilla.org/mozilla-central/file/58d067f89f59472dc1a89d573ccebb4850863efa/dom/media/MediaData.cpp#l111

Differential Revision: https://phabricator.services.mozilla.com/D187513
This commit is contained in:
alwu 2023-09-06 20:28:29 +00:00
parent 930166e6f7
commit 670ba7b802

View File

@ -2101,7 +2101,8 @@ class MediaDecoderStateMachine::AccurateSeekingState
}
bool ok = aAudio->SetTrimWindow(
{mSeekJob.mTarget->GetTime(), aAudio->GetEndTime()});
{mSeekJob.mTarget->GetTime().ToBase(aAudio->mTime),
aAudio->GetEndTime()});
if (!ok) {
return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR;
}