| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 , m_loadTimer(this, &HTMLMediaElement::loadTimerFired) | 329 , m_loadTimer(this, &HTMLMediaElement::loadTimerFired) |
| 330 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) | 330 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) |
| 331 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire
d) | 331 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire
d) |
| 332 , m_audioTracksTimer(this, &HTMLMediaElement::audioTracksTimerFired) | 332 , m_audioTracksTimer(this, &HTMLMediaElement::audioTracksTimerFired) |
| 333 , m_playedTimeRanges() | 333 , m_playedTimeRanges() |
| 334 , m_asyncEventQueue(GenericEventQueue::create(this)) | 334 , m_asyncEventQueue(GenericEventQueue::create(this)) |
| 335 , m_playbackRate(1.0f) | 335 , m_playbackRate(1.0f) |
| 336 , m_defaultPlaybackRate(1.0f) | 336 , m_defaultPlaybackRate(1.0f) |
| 337 , m_networkState(NETWORK_EMPTY) | 337 , m_networkState(NETWORK_EMPTY) |
| 338 , m_readyState(HAVE_NOTHING) | 338 , m_readyState(HAVE_NOTHING) |
| 339 , m_readyStateMaximum(HAVE_NOTHING) | |
| 340 , m_volume(1.0f) | 339 , m_volume(1.0f) |
| 341 , m_lastSeekTime(0) | 340 , m_lastSeekTime(0) |
| 342 , m_previousProgressTime(std::numeric_limits<double>::max()) | 341 , m_previousProgressTime(std::numeric_limits<double>::max()) |
| 343 , m_duration(std::numeric_limits<double>::quiet_NaN()) | 342 , m_duration(std::numeric_limits<double>::quiet_NaN()) |
| 344 , m_lastTimeUpdateEventWallTime(0) | 343 , m_lastTimeUpdateEventWallTime(0) |
| 345 , m_lastTimeUpdateEventMovieTime(0) | 344 , m_lastTimeUpdateEventMovieTime(0) |
| 346 , m_defaultPlaybackStartPosition(0) | 345 , m_defaultPlaybackStartPosition(0) |
| 347 , m_loadState(WaitingForSource) | 346 , m_loadState(WaitingForSource) |
| 348 , m_deferredLoadState(NotDeferred) | 347 , m_deferredLoadState(NotDeferred) |
| 349 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) | 348 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 scheduleEvent(EventTypeNames::emptied); | 788 scheduleEvent(EventTypeNames::emptied); |
| 790 | 789 |
| 791 // 4.2 - If a fetching process is in progress for the media element, the
user agent should stop it. | 790 // 4.2 - If a fetching process is in progress for the media element, the
user agent should stop it. |
| 792 m_networkState = NETWORK_EMPTY; | 791 m_networkState = NETWORK_EMPTY; |
| 793 | 792 |
| 794 // 4.3 - Forget the media element's media-resource-specific tracks. | 793 // 4.3 - Forget the media element's media-resource-specific tracks. |
| 795 forgetResourceSpecificTracks(); | 794 forgetResourceSpecificTracks(); |
| 796 | 795 |
| 797 // 4.4 - If readyState is not set to HAVE_NOTHING, then set it to that s
tate. | 796 // 4.4 - If readyState is not set to HAVE_NOTHING, then set it to that s
tate. |
| 798 m_readyState = HAVE_NOTHING; | 797 m_readyState = HAVE_NOTHING; |
| 799 m_readyStateMaximum = HAVE_NOTHING; | |
| 800 | 798 |
| 801 // 4.5 - If the paused attribute is false, then set it to true. | 799 // 4.5 - If the paused attribute is false, then set it to true. |
| 802 m_paused = true; | 800 m_paused = true; |
| 803 | 801 |
| 804 // 4.6 - If seeking is true, set it to false. | 802 // 4.6 - If seeking is true, set it to false. |
| 805 m_seeking = false; | 803 m_seeking = false; |
| 806 | 804 |
| 807 // 4.7 - Set the current playback position to 0. | 805 // 4.7 - Set the current playback position to 0. |
| 808 // Set the official playback position to 0. | 806 // Set the official playback position to 0. |
| 809 // If this changed the official playback position, then queue a ta
sk to fire a simple event named timeupdate at the media element. | 807 // If this changed the official playback position, then queue a ta
sk to fire a simple event named timeupdate at the media element. |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 m_readyState = newState; | 1793 m_readyState = newState; |
| 1796 } else { | 1794 } else { |
| 1797 // If a media file has text tracks the readyState may not progress beyon
d HAVE_FUTURE_DATA until | 1795 // If a media file has text tracks the readyState may not progress beyon
d HAVE_FUTURE_DATA until |
| 1798 // the text tracks are ready, regardless of the state of the media file. | 1796 // the text tracks are ready, regardless of the state of the media file. |
| 1799 if (newState <= HAVE_METADATA) | 1797 if (newState <= HAVE_METADATA) |
| 1800 m_readyState = newState; | 1798 m_readyState = newState; |
| 1801 else | 1799 else |
| 1802 m_readyState = HAVE_CURRENT_DATA; | 1800 m_readyState = HAVE_CURRENT_DATA; |
| 1803 } | 1801 } |
| 1804 | 1802 |
| 1805 if (oldState > m_readyStateMaximum) | |
| 1806 m_readyStateMaximum = oldState; | |
| 1807 | |
| 1808 if (m_networkState == NETWORK_EMPTY) | 1803 if (m_networkState == NETWORK_EMPTY) |
| 1809 return; | 1804 return; |
| 1810 | 1805 |
| 1811 if (m_seeking) { | 1806 if (m_seeking) { |
| 1812 // 4.8.10.9, step 9 note: If the media element was potentially playing i
mmediately before | 1807 // 4.8.10.9, step 9 note: If the media element was potentially playing i
mmediately before |
| 1813 // it started seeking, but seeking caused its readyState attribute to ch
ange to a value | 1808 // it started seeking, but seeking caused its readyState attribute to ch
ange to a value |
| 1814 // lower than HAVE_FUTURE_DATA, then a waiting will be fired at the elem
ent. | 1809 // lower than HAVE_FUTURE_DATA, then a waiting will be fired at the elem
ent. |
| 1815 if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) | 1810 if (wasPotentiallyPlaying && m_readyState < HAVE_FUTURE_DATA) |
| 1816 scheduleEvent(EventTypeNames::waiting); | 1811 scheduleEvent(EventTypeNames::waiting); |
| 1817 | 1812 |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3375 return TimeRanges::create(); | 3370 return TimeRanges::create(); |
| 3376 | 3371 |
| 3377 if (m_mediaSource) | 3372 if (m_mediaSource) |
| 3378 return m_mediaSource->seekable(); | 3373 return m_mediaSource->seekable(); |
| 3379 | 3374 |
| 3380 return TimeRanges::create(webMediaPlayer()->seekable()); | 3375 return TimeRanges::create(webMediaPlayer()->seekable()); |
| 3381 } | 3376 } |
| 3382 | 3377 |
| 3383 bool HTMLMediaElement::potentiallyPlaying() const | 3378 bool HTMLMediaElement::potentiallyPlaying() const |
| 3384 { | 3379 { |
| 3385 // "pausedToBuffer" means the media engine's rate is 0, but only because it
had to stop playing | 3380 // A media element is said to be potentially playing when its paused attribu
te is false, the |
| 3386 // when it ran out of buffered data. A movie is this state is "potentially p
laying", modulo the | 3381 // element has not ended playback, playback has not stopped due to errors, t
he element either |
| 3387 // checks in couldPlayIfEnoughData(). | 3382 // has no current media controller or has a current media controller but is
not blocked on its |
| 3388 bool pausedToBuffer = m_readyStateMaximum >= HAVE_FUTURE_DATA && m_readyStat
e < HAVE_FUTURE_DATA; | 3383 // media controller, and the element is not a blocked media element. |
| 3389 return (pausedToBuffer || m_readyState >= HAVE_FUTURE_DATA) && couldPlayIfEn
oughData() && !isBlockedOnMediaController(); | 3384 |
| 3385 if (paused()) |
| 3386 return false; |
| 3387 |
| 3388 if (endedPlayback()) |
| 3389 return false; |
| 3390 |
| 3391 if (stoppedDueToErrors()) |
| 3392 return false; |
| 3393 |
| 3394 if (isBlockedOnMediaController()) |
| 3395 return false; |
| 3396 |
| 3397 if (isBlocked()) |
| 3398 return false; |
| 3399 |
| 3400 return true; |
| 3390 } | 3401 } |
| 3391 | 3402 |
| 3392 bool HTMLMediaElement::couldPlayIfEnoughData() const | 3403 bool HTMLMediaElement::couldPlayIfEnoughData() const |
| 3393 { | 3404 { |
| 3394 return !paused() && !endedPlayback() && !stoppedDueToErrors(); | 3405 return !paused() && !endedPlayback() && !stoppedDueToErrors(); |
| 3395 } | 3406 } |
| 3396 | 3407 |
| 3397 bool HTMLMediaElement::endedPlayback() const | 3408 bool HTMLMediaElement::endedPlayback() const |
| 3398 { | 3409 { |
| 3399 double dur = duration(); | 3410 double dur = duration(); |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4111 | 4122 |
| 4112 #if ENABLE(WEB_AUDIO) | 4123 #if ENABLE(WEB_AUDIO) |
| 4113 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 4124 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
| 4114 { | 4125 { |
| 4115 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 4126 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
| 4116 audioSourceProvider()->setClient(nullptr); | 4127 audioSourceProvider()->setClient(nullptr); |
| 4117 } | 4128 } |
| 4118 #endif | 4129 #endif |
| 4119 | 4130 |
| 4120 } | 4131 } |
| OLD | NEW |