mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1108787 dispatch progress even when timer runs late r=cpearce
avoiding skipping progress events when data is received only soon after the previous progress event. --HG-- extra : rebase_source : 5108ae7d91bac613ed67f85c0963c6ca020bee07
This commit is contained in:
parent
39cecb01b3
commit
63b2b899ae
@ -1562,14 +1562,22 @@ void MediaDecoder::Progress(bool aTimer)
|
||||
mDataTime = now;
|
||||
}
|
||||
|
||||
// If PROGRESS_MS has passed since the last progress event fired and more
|
||||
// data has arrived since then, fire another progress event.
|
||||
if ((mProgressTime.IsNull() ||
|
||||
now - mProgressTime >= TimeDuration::FromMilliseconds(PROGRESS_MS)) &&
|
||||
!mDataTime.IsNull() &&
|
||||
now - mDataTime <= TimeDuration::FromMilliseconds(PROGRESS_MS)) {
|
||||
// If this is the first progress, or PROGRESS_MS has passed since the last
|
||||
// progress event fired and more data has arrived since then, fire a
|
||||
// progress event.
|
||||
if (!mDataTime.IsNull() &&
|
||||
(mProgressTime.IsNull() ||
|
||||
(now - mProgressTime >= TimeDuration::FromMilliseconds(PROGRESS_MS) &&
|
||||
mDataTime > mProgressTime))) {
|
||||
mOwner->DownloadProgressed();
|
||||
mProgressTime = now;
|
||||
// Resolution() ensures that future data will have now > mProgressTime,
|
||||
// and so will trigger another event. mDataTime is not reset because it
|
||||
// is still required to detect stalled; it is similarly offset by
|
||||
// resolution to indicate the new data has not yet arrived.
|
||||
mProgressTime = now - TimeDuration::Resolution();
|
||||
if (mDataTime > mProgressTime) {
|
||||
mDataTime = mProgressTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mDataTime.IsNull() &&
|
||||
|
Loading…
Reference in New Issue
Block a user