| Index: Source/WebCore/html/HTMLMediaElement.cpp
|
| diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
|
| index 84fe17387943f92f5c08b73e7c3865de1cd4aac8..e7a458bbfa822a839d8c2cfbb998015cdaf2efd2 100644
|
| --- a/Source/WebCore/html/HTMLMediaElement.cpp
|
| +++ b/Source/WebCore/html/HTMLMediaElement.cpp
|
| @@ -252,7 +252,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
|
| , m_lastSeekTime(0)
|
| , m_previousProgressTime(numeric_limits<double>::max())
|
| , m_lastTimeUpdateEventWallTime(0)
|
| - , m_lastTimeUpdateEventMovieTime(numeric_limits<float>::max())
|
| + , m_lastTimeUpdateEventMovieTime(numeric_limits<double>::max())
|
| , m_loadState(WaitingForSource)
|
| #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
|
| , m_proxyWidget(0)
|
| @@ -1085,7 +1085,7 @@ static bool eventTimeCueCompare(const std::pair<double, TextTrackCue*>& a,
|
| }
|
|
|
|
|
| -void HTMLMediaElement::updateActiveTextTrackCues(float movieTime)
|
| +void HTMLMediaElement::updateActiveTextTrackCues(double movieTime)
|
| {
|
| LOG(Media, "HTMLMediaElement::updateActiveTextTracks");
|
|
|
| @@ -1120,7 +1120,7 @@ void HTMLMediaElement::updateActiveTextTrackCues(float movieTime)
|
| // 3 - Let last time be the current playback position at the time this
|
| // algorithm was last run for this media element, if this is not the first
|
| // time it has run.
|
| - float lastTime = m_lastTextTrackUpdateTime;
|
| + double lastTime = m_lastTextTrackUpdateTime;
|
|
|
| // 4 - If the current playback position has, since the last time this
|
| // algorithm was run, only changed through its usual monotonic increase
|
| @@ -1133,8 +1133,8 @@ void HTMLMediaElement::updateActiveTextTrackCues(float movieTime)
|
| m_cueTree.allOverlaps(m_cueTree.createInterval(lastTime, movieTime));
|
|
|
| for (size_t i = 0; i < potentiallySkippedCues.size(); ++i) {
|
| - float cueStartTime = potentiallySkippedCues[i].low();
|
| - float cueEndTime = potentiallySkippedCues[i].high();
|
| + double cueStartTime = potentiallySkippedCues[i].low();
|
| + double cueEndTime = potentiallySkippedCues[i].high();
|
|
|
| // Consider cues that may have been missed since the last seek time.
|
| if (cueStartTime > max(m_lastSeekTime, lastTime) && cueEndTime < movieTime)
|
| @@ -1974,7 +1974,7 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
|
| }
|
| }
|
|
|
| -void HTMLMediaElement::rewind(float timeDelta)
|
| +void HTMLMediaElement::rewind(double timeDelta)
|
| {
|
| LOG(Media, "HTMLMediaElement::rewind(%f)", timeDelta);
|
| setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), IGNORE_EXCEPTION);
|
| @@ -1986,7 +1986,7 @@ void HTMLMediaElement::returnToRealtime()
|
| setCurrentTime(maxTimeSeekable(), IGNORE_EXCEPTION);
|
| }
|
|
|
| -void HTMLMediaElement::addPlayedRange(float start, float end)
|
| +void HTMLMediaElement::addPlayedRange(double start, double end)
|
| {
|
| LOG(Media, "HTMLMediaElement::addPlayedRange(%f, %f)", start, end);
|
| if (!m_playedTimeRanges)
|
| @@ -2013,7 +2013,7 @@ void HTMLMediaElement::prepareToPlay()
|
| m_player->prepareToPlay();
|
| }
|
|
|
| -void HTMLMediaElement::seek(float time, ExceptionCode& ec)
|
| +void HTMLMediaElement::seek(double time, ExceptionCode& ec)
|
| {
|
| LOG(Media, "HTMLMediaElement::seek(%f)", time);
|
|
|
| @@ -2031,7 +2031,7 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec)
|
|
|
| // Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set.
|
| refreshCachedTime();
|
| - float now = currentTime();
|
| + double now = currentTime();
|
|
|
| // 2 - If the element's seeking IDL attribute is true, then another instance of this algorithm is
|
| // already running. Abort that other instance of the algorithm without waiting for the step that
|
| @@ -2047,7 +2047,7 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec)
|
| time = min(time, duration());
|
|
|
| // 6 - If the new playback position is less than the earliest possible position, let it be that position instead.
|
| - float earliestTime = m_player->startTime();
|
| + double earliestTime = m_player->startTime();
|
| time = max(time, earliestTime);
|
|
|
| // Ask the media engine for the time value in the movie's time scale before comparing with current time. This
|
| @@ -2056,7 +2056,7 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec)
|
| // not generate a timechanged callback. This means m_seeking will never be cleared and we will never
|
| // fire a 'seeked' event.
|
| #if !LOG_DISABLED
|
| - float mediaTime = m_player->mediaTimeForTimeValue(time);
|
| + double mediaTime = m_player->mediaTimeForTimeValue(time);
|
| if (time != mediaTime)
|
| LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
|
| #endif
|
| @@ -2163,7 +2163,7 @@ void HTMLMediaElement::invalidateCachedTime()
|
| }
|
|
|
| // playback state
|
| -float HTMLMediaElement::currentTime() const
|
| +double HTMLMediaElement::currentTime() const
|
| {
|
| #if LOG_CACHED_TIME_WARNINGS
|
| static const double minCachedDeltaForWarning = 0.01;
|
| @@ -2179,7 +2179,7 @@ float HTMLMediaElement::currentTime() const
|
|
|
| if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) {
|
| #if LOG_CACHED_TIME_WARNINGS
|
| - float delta = m_cachedTime - m_player->currentTime();
|
| + double delta = m_cachedTime - m_player->currentTime();
|
| if (delta > minCachedDeltaForWarning)
|
| LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time is %f seconds off of media time when paused", delta);
|
| #endif
|
| @@ -2195,10 +2195,10 @@ float HTMLMediaElement::currentTime() const
|
|
|
| // Not too soon, use the cached time only if it hasn't expired.
|
| if (wallClockDelta < maximumDurationToCacheMediaTime) {
|
| - float adjustedCacheTime = static_cast<float>(m_cachedTime + (m_playbackRate * wallClockDelta));
|
| + double adjustedCacheTime = m_cachedTime + (m_playbackRate * wallClockDelta);
|
|
|
| #if LOG_CACHED_TIME_WARNINGS
|
| - float delta = adjustedCacheTime - m_player->currentTime();
|
| + double delta = adjustedCacheTime - m_player->currentTime();
|
| if (delta > minCachedDeltaForWarning)
|
| LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time is %f seconds off of media time when playing", delta);
|
| #endif
|
| @@ -2209,7 +2209,7 @@ float HTMLMediaElement::currentTime() const
|
| #if LOG_CACHED_TIME_WARNINGS
|
| if (maximumDurationToCacheMediaTime && now > m_minimumWallClockTimeToCacheMediaTime && m_cachedTime != MediaPlayer::invalidTime()) {
|
| double wallClockDelta = now - m_cachedTimeWallClockUpdateTime;
|
| - float delta = m_cachedTime + (m_playbackRate * wallClockDelta) - m_player->currentTime();
|
| + double delta = m_cachedTime + (m_playbackRate * wallClockDelta) - m_player->currentTime();
|
| LOG(Media, "HTMLMediaElement::currentTime - cached time was %f seconds off of media time when it expired", delta);
|
| }
|
| #endif
|
| @@ -2219,7 +2219,7 @@ float HTMLMediaElement::currentTime() const
|
| return m_cachedTime;
|
| }
|
|
|
| -void HTMLMediaElement::setCurrentTime(float time, ExceptionCode& ec)
|
| +void HTMLMediaElement::setCurrentTime(double time, ExceptionCode& ec)
|
| {
|
| if (m_mediaController) {
|
| ec = INVALID_STATE_ERR;
|
| @@ -2228,7 +2228,7 @@ void HTMLMediaElement::setCurrentTime(float time, ExceptionCode& ec)
|
| seek(time, ec);
|
| }
|
|
|
| -float HTMLMediaElement::startTime() const
|
| +double HTMLMediaElement::startTime() const
|
| {
|
| if (!m_player)
|
| return 0;
|
| @@ -2246,12 +2246,12 @@ double HTMLMediaElement::initialTime() const
|
| return m_player->initialTime();
|
| }
|
|
|
| -float HTMLMediaElement::duration() const
|
| +double HTMLMediaElement::duration() const
|
| {
|
| if (m_player && m_readyState >= HAVE_METADATA)
|
| return m_player->duration();
|
|
|
| - return numeric_limits<float>::quiet_NaN();
|
| + return numeric_limits<double>::quiet_NaN();
|
| }
|
|
|
| bool HTMLMediaElement::paused() const
|
| @@ -2259,12 +2259,12 @@ bool HTMLMediaElement::paused() const
|
| return m_paused;
|
| }
|
|
|
| -float HTMLMediaElement::defaultPlaybackRate() const
|
| +double HTMLMediaElement::defaultPlaybackRate() const
|
| {
|
| return m_defaultPlaybackRate;
|
| }
|
|
|
| -void HTMLMediaElement::setDefaultPlaybackRate(float rate)
|
| +void HTMLMediaElement::setDefaultPlaybackRate(double rate)
|
| {
|
| if (m_defaultPlaybackRate != rate) {
|
| m_defaultPlaybackRate = rate;
|
| @@ -2272,12 +2272,12 @@ void HTMLMediaElement::setDefaultPlaybackRate(float rate)
|
| }
|
| }
|
|
|
| -float HTMLMediaElement::playbackRate() const
|
| +double HTMLMediaElement::playbackRate() const
|
| {
|
| return m_playbackRate;
|
| }
|
|
|
| -void HTMLMediaElement::setPlaybackRate(float rate)
|
| +void HTMLMediaElement::setPlaybackRate(double rate)
|
| {
|
| LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate);
|
|
|
| @@ -2293,7 +2293,7 @@ void HTMLMediaElement::setPlaybackRate(float rate)
|
|
|
| void HTMLMediaElement::updatePlaybackRate()
|
| {
|
| - float effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate;
|
| + double effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate;
|
| if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate)
|
| m_player->setRate(effectiveRate);
|
| }
|
| @@ -2589,12 +2589,12 @@ void HTMLMediaElement::setControls(bool b)
|
| setBooleanAttribute(controlsAttr, b);
|
| }
|
|
|
| -float HTMLMediaElement::volume() const
|
| +double HTMLMediaElement::volume() const
|
| {
|
| return m_volume;
|
| }
|
|
|
| -void HTMLMediaElement::setVolume(float vol, ExceptionCode& ec)
|
| +void HTMLMediaElement::setVolume(double vol, ExceptionCode& ec)
|
| {
|
| LOG(Media, "HTMLMediaElement::setVolume(%f)", vol);
|
|
|
| @@ -2723,7 +2723,7 @@ void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent)
|
|
|
| // Some media engines make multiple "time changed" callbacks at the same time, but we only want one
|
| // event at a given time so filter here
|
| - float movieTime = currentTime();
|
| + double movieTime = currentTime();
|
| if (movieTime != m_lastTimeUpdateEventMovieTime) {
|
| scheduleEvent(eventNames().timeupdateEvent);
|
| m_lastTimeUpdateEventWallTime = now;
|
| @@ -2736,20 +2736,20 @@ bool HTMLMediaElement::canPlay() const
|
| return paused() || ended() || m_readyState < HAVE_METADATA;
|
| }
|
|
|
| -float HTMLMediaElement::percentLoaded() const
|
| +double HTMLMediaElement::percentLoaded() const
|
| {
|
| if (!m_player)
|
| return 0;
|
| - float duration = m_player->duration();
|
| + double duration = m_player->duration();
|
|
|
| if (!duration || std::isinf(duration))
|
| return 0;
|
|
|
| - float buffered = 0;
|
| + double buffered = 0;
|
| RefPtr<TimeRanges> timeRanges = m_player->buffered();
|
| for (unsigned i = 0; i < timeRanges->length(); ++i) {
|
| - float start = timeRanges->start(i, IGNORE_EXCEPTION);
|
| - float end = timeRanges->end(i, IGNORE_EXCEPTION);
|
| + double start = timeRanges->start(i, IGNORE_EXCEPTION);
|
| + double end = timeRanges->end(i, IGNORE_EXCEPTION);
|
| buffered += end - start;
|
| }
|
| return buffered / duration;
|
| @@ -3419,8 +3419,8 @@ void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*)
|
| // movie time.
|
| scheduleTimeupdateEvent(false);
|
|
|
| - float now = currentTime();
|
| - float dur = duration();
|
| + double now = currentTime();
|
| + double dur = duration();
|
|
|
| // When the current playback position reaches the end of the media resource when the direction of
|
| // playback is forwards, then the user agent must follow these steps:
|
| @@ -3462,7 +3462,7 @@ void HTMLMediaElement::mediaPlayerVolumeChanged(MediaPlayer*)
|
|
|
| beginProcessingMediaPlayerCallback();
|
| if (m_player) {
|
| - float vol = m_player->volume();
|
| + double vol = m_player->volume();
|
| if (vol != m_volume) {
|
| m_volume = vol;
|
| updateVolume();
|
| @@ -3491,8 +3491,8 @@ void HTMLMediaElement::mediaPlayerDurationChanged(MediaPlayer* player)
|
| scheduleEvent(eventNames().durationchangeEvent);
|
| mediaPlayerCharacteristicChanged(player);
|
|
|
| - float now = currentTime();
|
| - float dur = duration();
|
| + double now = currentTime();
|
| + double dur = duration();
|
| if (now > dur)
|
| seek(dur, IGNORE_EXCEPTION);
|
|
|
| @@ -3647,7 +3647,7 @@ PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const
|
| PassRefPtr<TimeRanges> HTMLMediaElement::played()
|
| {
|
| if (m_playing) {
|
| - float time = currentTime();
|
| + double time = currentTime();
|
| if (time > m_lastSeekTime)
|
| addPlayedRange(m_lastSeekTime, time);
|
| }
|
| @@ -3679,7 +3679,7 @@ bool HTMLMediaElement::couldPlayIfEnoughData() const
|
|
|
| bool HTMLMediaElement::endedPlayback() const
|
| {
|
| - float dur = duration();
|
| + double dur = duration();
|
| if (!m_player || std::isnan(dur))
|
| return false;
|
|
|
| @@ -3693,7 +3693,7 @@ bool HTMLMediaElement::endedPlayback() const
|
| // and the current playback position is the end of the media resource and the direction
|
| // of playback is forwards, Either the media element does not have a loop attribute specified,
|
| // or the media element has a current media controller.
|
| - float now = currentTime();
|
| + double now = currentTime();
|
| if (m_playbackRate > 0)
|
| return dur > 0 && now >= dur && (!loop() || m_mediaController);
|
|
|
| @@ -3722,12 +3722,12 @@ bool HTMLMediaElement::pausedForUserInteraction() const
|
| return false;
|
| }
|
|
|
| -float HTMLMediaElement::minTimeSeekable() const
|
| +double HTMLMediaElement::minTimeSeekable() const
|
| {
|
| return 0;
|
| }
|
|
|
| -float HTMLMediaElement::maxTimeSeekable() const
|
| +double HTMLMediaElement::maxTimeSeekable() const
|
| {
|
| return m_player ? m_player->maxTimeSeekable() : 0;
|
| }
|
| @@ -3740,7 +3740,7 @@ void HTMLMediaElement::updateVolume()
|
| // Avoid recursion when the player reports volume changes.
|
| if (!processingMediaPlayerCallback()) {
|
| Page* page = document()->page();
|
| - float volumeMultiplier = page ? page->mediaVolume() : 1;
|
| + double volumeMultiplier = page ? page->mediaVolume() : 1;
|
| bool shouldMute = m_muted;
|
|
|
| if (m_mediaController) {
|
| @@ -3805,7 +3805,7 @@ void HTMLMediaElement::updatePlayState()
|
|
|
| m_playbackProgressTimer.stop();
|
| m_playing = false;
|
| - float time = currentTime();
|
| + double time = currentTime();
|
| if (time > m_lastSeekTime)
|
| addPlayedRange(m_lastSeekTime, time);
|
|
|
| @@ -4645,7 +4645,7 @@ bool HTMLMediaElement::isBlockedOnMediaController() const
|
| // or if its media controller position is either before the media resource's earliest possible
|
| // position relative to the MediaController's timeline or after the end of the media resource
|
| // relative to the MediaController's timeline.
|
| - float mediaControllerPosition = m_mediaController->currentTime();
|
| + double mediaControllerPosition = m_mediaController->currentTime();
|
| if (mediaControllerPosition < startTime() || mediaControllerPosition > startTime() + duration())
|
| return true;
|
|
|
| @@ -4655,7 +4655,7 @@ bool HTMLMediaElement::isBlockedOnMediaController() const
|
| void HTMLMediaElement::prepareMediaFragmentURI()
|
| {
|
| MediaFragmentURIParser fragmentParser(m_currentSrc);
|
| - float dur = duration();
|
| + double dur = duration();
|
|
|
| double start = fragmentParser.startTime();
|
| if (start != MediaFragmentURIParser::invalidTimeValue() && start > 0) {
|
|
|