Bug 1595603 - part2 : delay seeking task when media is inactive r=bryce
When media element is inactive, asking MDSM to seek is actually useless, because all the data we decode won't be showed to user. In addition, we have to store extra pending events for `seeking` and `seeked`, which might result in memory overflow if the inactive page is calling `seek()` all the time. Therfore, we should delay all seeking tasks while media is inactive, and perform the latest seeking task when media becomes active. Differential Revision: https://phabricator.services.mozilla.com/D58918
This commit is contained in:
@@ -6526,6 +6526,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aSuspendElement) {
|
||||
if (mDecoder) {
|
||||
mDecoder->Pause();
|
||||
mDecoder->Suspend();
|
||||
mDecoder->SetDelaySeekMode(true);
|
||||
}
|
||||
mEventDeliveryPaused = true;
|
||||
// We won't want to resume media element from the bfcache.
|
||||
@@ -6540,6 +6541,7 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aSuspendElement) {
|
||||
if (!mPaused && !mDecoder->IsEnded()) {
|
||||
mDecoder->Play();
|
||||
}
|
||||
mDecoder->SetDelaySeekMode(false);
|
||||
}
|
||||
if (mEventDeliveryPaused) {
|
||||
mEventDeliveryPaused = false;
|
||||
|
||||
Reference in New Issue
Block a user