commit ef267bb694d7a63048a125de46218665b93104b6
parent e00ee9c5dc6fbeeed3f230a8077227f2dae251ec
Author: Alexandru Marc <amarc@mozilla.com>
Date: Mon, 27 Oct 2025 12:28:14 +0200
Revert "Bug 1996196 - Use Now instead of NowLoRes in HTMLMediaElement. r=alwu" by dev request
This reverts commit 43307fa6bc0b490b20026299e81f7132c81d2959.
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/dom/media/mediaelement/HTMLMediaElement.cpp b/dom/media/mediaelement/HTMLMediaElement.cpp
@@ -6110,7 +6110,7 @@ void HTMLMediaElement::CheckProgress(bool aHaveNewProgress) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mNetworkState == NETWORK_LOADING);
- TimeStamp now = TimeStamp::Now();
+ TimeStamp now = TimeStamp::NowLoRes();
if (aHaveNewProgress) {
mDataTime = now;
@@ -6128,7 +6128,14 @@ void HTMLMediaElement::CheckProgress(bool aHaveNewProgress) {
TimeDuration::FromMilliseconds(PROGRESS_MS) &&
mDataTime > mProgressTime)) {
QueueEvent(u"progress"_ns);
- 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 (!mProgressTimer) {
NS_ASSERTION(aHaveNewProgress,
"timer dispatched when there was no timer");
@@ -6179,7 +6186,7 @@ void HTMLMediaElement::StartProgressTimer() {
void HTMLMediaElement::StartProgress() {
// Record the time now for detecting stalled.
- mDataTime = TimeStamp::Now();
+ mDataTime = TimeStamp::NowLoRes();
// Reset mProgressTime so that mDataTime is not indicating bytes received
// after the last progress event.
mProgressTime = TimeStamp();