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

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

Issue 319213002: Fix MediaSource.duration setter behavior to match the current spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix release build buster Created 6 years, 6 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') | Source/modules/mediasource/MediaSource.h » ('j') | 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 b60072a0a8655ea96075e6d57634d6ec75fb2eea..ed492e581334d7b474003da397eae42f9782ab7c 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -1776,7 +1776,9 @@ void HTMLMediaElement::setReadyState(ReadyState state)
selectInitialTracksIfNecessary();
+ m_duration = duration();
scheduleEvent(EventTypeNames::durationchange);
+
if (isHTMLVideoElement(*this))
scheduleEvent(EventTypeNames::resize);
scheduleEvent(EventTypeNames::loadedmetadata);
@@ -3063,17 +3065,22 @@ void HTMLMediaElement::mediaPlayerTimeChanged()
void HTMLMediaElement::mediaPlayerDurationChanged()
{
WTF_LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged");
- durationChanged(duration());
+ // FIXME: Change MediaPlayerClient & WebMediaPlayer to convey
+ // the currentTime when the duration change occured. The current
+ // WebMediaPlayer implementations always clamp currentTime() to
+ // duration() so the requestSeek condition here is always false.
+ durationChanged(duration(), currentTime() > duration());
}
-void HTMLMediaElement::durationChanged(double duration)
+void HTMLMediaElement::durationChanged(double duration, bool requestSeek)
{
- WTF_LOG(Media, "HTMLMediaElement::durationChanged(%f)", duration);
+ WTF_LOG(Media, "HTMLMediaElement::durationChanged(%f, %d)", duration, requestSeek);
// Abort if duration unchanged.
if (m_duration == duration)
return;
+ WTF_LOG(Media, "HTMLMediaElement::durationChanged : %f -> %f", m_duration, duration);
m_duration = duration;
scheduleEvent(EventTypeNames::durationchange);
@@ -3082,7 +3089,7 @@ void HTMLMediaElement::durationChanged(double duration)
if (renderer())
renderer()->updateFromElement();
- if (currentTime() > duration)
+ if (requestSeek)
seek(duration, IGNORE_EXCEPTION);
}
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/modules/mediasource/MediaSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698