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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 592 |
593 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe
source)) { | 593 if ((actionType & LoadMediaResource) && !(m_pendingActionFlags & LoadMediaRe
source)) { |
594 prepareForLoad(); | 594 prepareForLoad(); |
595 m_pendingActionFlags |= LoadMediaResource; | 595 m_pendingActionFlags |= LoadMediaResource; |
596 } | 596 } |
597 | 597 |
598 if (actionType & LoadTextTrackResource) | 598 if (actionType & LoadTextTrackResource) |
599 m_pendingActionFlags |= LoadTextTrackResource; | 599 m_pendingActionFlags |= LoadTextTrackResource; |
600 | 600 |
601 if (!m_loadTimer.isActive()) | 601 if (!m_loadTimer.isActive()) |
602 m_loadTimer.startOneShot(0, FROM_HERE); | 602 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); |
603 } | 603 } |
604 | 604 |
605 void HTMLMediaElement::scheduleNextSourceChild() | 605 void HTMLMediaElement::scheduleNextSourceChild() |
606 { | 606 { |
607 // Schedule the timer to try the next <source> element WITHOUT resetting sta
te ala prepareForLoad. | 607 // Schedule the timer to try the next <source> element WITHOUT resetting sta
te ala prepareForLoad. |
608 m_pendingActionFlags |= LoadMediaResource; | 608 m_pendingActionFlags |= LoadMediaResource; |
609 m_loadTimer.startOneShot(0, FROM_HERE); | 609 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); |
610 } | 610 } |
611 | 611 |
612 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 612 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
613 { | 613 { |
614 scheduleEvent(Event::createCancelable(eventName)); | 614 scheduleEvent(Event::createCancelable(eventName)); |
615 } | 615 } |
616 | 616 |
617 void HTMLMediaElement::scheduleEvent(PassRefPtrWillBeRawPtr<Event> event) | 617 void HTMLMediaElement::scheduleEvent(PassRefPtrWillBeRawPtr<Event> event) |
618 { | 618 { |
619 #if LOG_MEDIA_EVENTS | 619 #if LOG_MEDIA_EVENTS |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 void HTMLMediaElement::deferLoad() | 1079 void HTMLMediaElement::deferLoad() |
1080 { | 1080 { |
1081 // This implements the "optional" step 3 from the resource fetch algorithm. | 1081 // This implements the "optional" step 3 from the resource fetch algorithm. |
1082 ASSERT(!m_deferredLoadTimer.isActive()); | 1082 ASSERT(!m_deferredLoadTimer.isActive()); |
1083 ASSERT(m_deferredLoadState == NotDeferred); | 1083 ASSERT(m_deferredLoadState == NotDeferred); |
1084 // 1. Set the networkState to NETWORK_IDLE. | 1084 // 1. Set the networkState to NETWORK_IDLE. |
1085 // 2. Queue a task to fire a simple event named suspend at the element. | 1085 // 2. Queue a task to fire a simple event named suspend at the element. |
1086 changeNetworkStateFromLoadingToIdle(); | 1086 changeNetworkStateFromLoadingToIdle(); |
1087 // 3. Queue a task to set the element's delaying-the-load-event | 1087 // 3. Queue a task to set the element's delaying-the-load-event |
1088 // flag to false. This stops delaying the load event. | 1088 // flag to false. This stops delaying the load event. |
1089 m_deferredLoadTimer.startOneShot(0, FROM_HERE); | 1089 m_deferredLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
1090 // 4. Wait for the task to be run. | 1090 // 4. Wait for the task to be run. |
1091 m_deferredLoadState = WaitingForStopDelayingLoadEventTask; | 1091 m_deferredLoadState = WaitingForStopDelayingLoadEventTask; |
1092 // Continued in executeDeferredLoad(). | 1092 // Continued in executeDeferredLoad(). |
1093 } | 1093 } |
1094 | 1094 |
1095 void HTMLMediaElement::cancelDeferredLoad() | 1095 void HTMLMediaElement::cancelDeferredLoad() |
1096 { | 1096 { |
1097 m_deferredLoadTimer.stop(); | 1097 m_deferredLoadTimer.stop(); |
1098 m_deferredLoadState = NotDeferred; | 1098 m_deferredLoadState = NotDeferred; |
1099 } | 1099 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 return hasSingleSecurityOrigin() && ((webMediaPlayer() && webMediaPlayer()->
didPassCORSAccessCheck()) || !origin->taintsCanvas(currentSrc())); | 1228 return hasSingleSecurityOrigin() && ((webMediaPlayer() && webMediaPlayer()->
didPassCORSAccessCheck()) || !origin->taintsCanvas(currentSrc())); |
1229 } | 1229 } |
1230 | 1230 |
1231 void HTMLMediaElement::startProgressEventTimer() | 1231 void HTMLMediaElement::startProgressEventTimer() |
1232 { | 1232 { |
1233 if (m_progressEventTimer.isActive()) | 1233 if (m_progressEventTimer.isActive()) |
1234 return; | 1234 return; |
1235 | 1235 |
1236 m_previousProgressTime = WTF::currentTime(); | 1236 m_previousProgressTime = WTF::currentTime(); |
1237 // 350ms is not magic, it is in the spec! | 1237 // 350ms is not magic, it is in the spec! |
1238 m_progressEventTimer.startRepeating(0.350, FROM_HERE); | 1238 m_progressEventTimer.startRepeating(0.350, BLINK_FROM_HERE); |
1239 } | 1239 } |
1240 | 1240 |
1241 void HTMLMediaElement::waitForSourceChange() | 1241 void HTMLMediaElement::waitForSourceChange() |
1242 { | 1242 { |
1243 WTF_LOG(Media, "HTMLMediaElement::waitForSourceChange(%p)", this); | 1243 WTF_LOG(Media, "HTMLMediaElement::waitForSourceChange(%p)", this); |
1244 | 1244 |
1245 stopPeriodicTimers(); | 1245 stopPeriodicTimers(); |
1246 m_loadState = WaitingForSource; | 1246 m_loadState = WaitingForSource; |
1247 | 1247 |
1248 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N
O_SOURCE value | 1248 // 6.17 - Waiting: Set the element's networkState attribute to the NETWORK_N
O_SOURCE value |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 // The spec says to fire periodic timeupdate events (those sent while playing) e
very | 2184 // The spec says to fire periodic timeupdate events (those sent while playing) e
very |
2185 // "15 to 250ms", we choose the slowest frequency | 2185 // "15 to 250ms", we choose the slowest frequency |
2186 static const double maxTimeupdateEventFrequency = 0.25; | 2186 static const double maxTimeupdateEventFrequency = 0.25; |
2187 | 2187 |
2188 void HTMLMediaElement::startPlaybackProgressTimer() | 2188 void HTMLMediaElement::startPlaybackProgressTimer() |
2189 { | 2189 { |
2190 if (m_playbackProgressTimer.isActive()) | 2190 if (m_playbackProgressTimer.isActive()) |
2191 return; | 2191 return; |
2192 | 2192 |
2193 m_previousProgressTime = WTF::currentTime(); | 2193 m_previousProgressTime = WTF::currentTime(); |
2194 m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency, FROM_HER
E); | 2194 m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency, BLINK_FR
OM_HERE); |
2195 } | 2195 } |
2196 | 2196 |
2197 void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*) | 2197 void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*) |
2198 { | 2198 { |
2199 if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime &&
directionOfPlayback() == Forward) { | 2199 if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime &&
directionOfPlayback() == Forward) { |
2200 m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN(); | 2200 m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN(); |
2201 if (!m_mediaController && !m_paused) { | 2201 if (!m_mediaController && !m_paused) { |
2202 UseCounter::count(document(), UseCounter::HTMLMediaElementPauseAtFra
gmentEnd); | 2202 UseCounter::count(document(), UseCounter::HTMLMediaElementPauseAtFra
gmentEnd); |
2203 // changes paused to true and fires a simple event named pause at th
e media element. | 2203 // changes paused to true and fires a simple event named pause at th
e media element. |
2204 pause(); | 2204 pause(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2268 void HTMLMediaElement::audioTrackChanged() | 2268 void HTMLMediaElement::audioTrackChanged() |
2269 { | 2269 { |
2270 WTF_LOG(Media, "HTMLMediaElement::audioTrackChanged(%p)", this); | 2270 WTF_LOG(Media, "HTMLMediaElement::audioTrackChanged(%p)", this); |
2271 ASSERT(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 2271 ASSERT(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
2272 | 2272 |
2273 audioTracks().scheduleChangeEvent(); | 2273 audioTracks().scheduleChangeEvent(); |
2274 | 2274 |
2275 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.audioTracks attribute is added. | 2275 // FIXME: Add call on m_mediaSource to notify it of track changes once the S
ourceBuffer.audioTracks attribute is added. |
2276 | 2276 |
2277 if (!m_audioTracksTimer.isActive()) | 2277 if (!m_audioTracksTimer.isActive()) |
2278 m_audioTracksTimer.startOneShot(0, FROM_HERE); | 2278 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); |
2279 } | 2279 } |
2280 | 2280 |
2281 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) | 2281 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) |
2282 { | 2282 { |
2283 Vector<WebMediaPlayer::TrackId> enabledTrackIds; | 2283 Vector<WebMediaPlayer::TrackId> enabledTrackIds; |
2284 for (unsigned i = 0; i < audioTracks().length(); ++i) { | 2284 for (unsigned i = 0; i < audioTracks().length(); ++i) { |
2285 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); | 2285 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); |
2286 if (track->enabled()) | 2286 if (track->enabled()) |
2287 enabledTrackIds.append(track->trackId()); | 2287 enabledTrackIds.append(track->trackId()); |
2288 } | 2288 } |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3814 visitor->trace(m_client); | 3814 visitor->trace(m_client); |
3815 } | 3815 } |
3816 | 3816 |
3817 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3817 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
3818 { | 3818 { |
3819 visitor->trace(m_client); | 3819 visitor->trace(m_client); |
3820 } | 3820 } |
3821 #endif | 3821 #endif |
3822 | 3822 |
3823 } | 3823 } |
OLD | NEW |