Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(967)

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 578113002: Add back HTMLMediaElement::m_lastTimeUpdateEventMovieTime. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: the fix Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index f1a270cdece73a6f1201df876ebba5beab02f0df..3ab630d23ff36095872dfc452e3e63232c219f40 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -323,6 +323,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
, m_previousProgressTime(std::numeric_limits<double>::max())
, m_duration(std::numeric_limits<double>::quiet_NaN())
, m_lastTimeUpdateEventWallTime(0)
+ , m_lastTimeUpdateEventMovieTime(std::numeric_limits<double>::max())
, m_defaultPlaybackStartPosition(0)
, m_loadState(WaitingForSource)
, m_deferredLoadState(NotDeferred)
@@ -2452,14 +2453,19 @@ void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*)
void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent)
{
double now = WTF::currentTime();
- double timedelta = now - m_lastTimeUpdateEventWallTime;
+ double movieTime = currentTime();
- // throttle the periodic events
- if (periodicEvent && timedelta < maxTimeupdateEventFrequency)
- return;
+ bool haveNotRecentlyFiredTimeupdate = (now - m_lastTimeUpdateEventWallTime) >= maxTimeupdateEventFrequency;
+ bool movieTimeHasProgressed = movieTime != m_lastTimeUpdateEventMovieTime;
- scheduleEvent(EventTypeNames::timeupdate);
- m_lastTimeUpdateEventWallTime = now;
+ // Non-periodic timeupdate events must always fire as mandated by the spec,
+ // otherwise we shouldn't fire duplicate periodic timeupdate events when the
+ // movie time hasn't changed.
+ if (!periodicEvent || (haveNotRecentlyFiredTimeupdate && movieTimeHasProgressed)) {
+ scheduleEvent(EventTypeNames::timeupdate);
+ m_lastTimeUpdateEventWallTime = now;
+ m_lastTimeUpdateEventMovieTime = movieTime;
+ }
}
bool HTMLMediaElement::togglePlayStateWillPlay() const
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698