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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 , m_playbackRate(1.0f) | 316 , m_playbackRate(1.0f) |
317 , m_defaultPlaybackRate(1.0f) | 317 , m_defaultPlaybackRate(1.0f) |
318 , m_networkState(NETWORK_EMPTY) | 318 , m_networkState(NETWORK_EMPTY) |
319 , m_readyState(HAVE_NOTHING) | 319 , m_readyState(HAVE_NOTHING) |
320 , m_readyStateMaximum(HAVE_NOTHING) | 320 , m_readyStateMaximum(HAVE_NOTHING) |
321 , m_volume(1.0f) | 321 , m_volume(1.0f) |
322 , m_lastSeekTime(0) | 322 , m_lastSeekTime(0) |
323 , m_previousProgressTime(std::numeric_limits<double>::max()) | 323 , m_previousProgressTime(std::numeric_limits<double>::max()) |
324 , m_duration(std::numeric_limits<double>::quiet_NaN()) | 324 , m_duration(std::numeric_limits<double>::quiet_NaN()) |
325 , m_lastTimeUpdateEventWallTime(0) | 325 , m_lastTimeUpdateEventWallTime(0) |
| 326 , m_lastTimeUpdateEventMovieTime(std::numeric_limits<double>::max()) |
326 , m_defaultPlaybackStartPosition(0) | 327 , m_defaultPlaybackStartPosition(0) |
327 , m_loadState(WaitingForSource) | 328 , m_loadState(WaitingForSource) |
328 , m_deferredLoadState(NotDeferred) | 329 , m_deferredLoadState(NotDeferred) |
329 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) | 330 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) |
330 , m_webLayer(0) | 331 , m_webLayer(0) |
331 , m_preload(MediaPlayer::Auto) | 332 , m_preload(MediaPlayer::Auto) |
332 , m_displayMode(Unknown) | 333 , m_displayMode(Unknown) |
333 , m_cachedTime(MediaPlayer::invalidTime()) | 334 , m_cachedTime(MediaPlayer::invalidTime()) |
334 , m_fragmentEndTime(MediaPlayer::invalidTime()) | 335 , m_fragmentEndTime(MediaPlayer::invalidTime()) |
335 , m_pendingActionFlags(0) | 336 , m_pendingActionFlags(0) |
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 | 2446 |
2446 if (!m_paused && hasMediaControls()) | 2447 if (!m_paused && hasMediaControls()) |
2447 mediaControls()->playbackProgressed(); | 2448 mediaControls()->playbackProgressed(); |
2448 | 2449 |
2449 updateActiveTextTrackCues(currentTime()); | 2450 updateActiveTextTrackCues(currentTime()); |
2450 } | 2451 } |
2451 | 2452 |
2452 void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent) | 2453 void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent) |
2453 { | 2454 { |
2454 double now = WTF::currentTime(); | 2455 double now = WTF::currentTime(); |
2455 double timedelta = now - m_lastTimeUpdateEventWallTime; | 2456 double movieTime = currentTime(); |
2456 | 2457 |
2457 // throttle the periodic events | 2458 bool haveNotRecentlyFiredTimeupdate = (now - m_lastTimeUpdateEventWallTime)
>= maxTimeupdateEventFrequency; |
2458 if (periodicEvent && timedelta < maxTimeupdateEventFrequency) | 2459 bool movieTimeHasProgressed = movieTime != m_lastTimeUpdateEventMovieTime; |
2459 return; | |
2460 | 2460 |
2461 scheduleEvent(EventTypeNames::timeupdate); | 2461 // Non-periodic timeupdate events must always fire as mandated by the spec, |
2462 m_lastTimeUpdateEventWallTime = now; | 2462 // otherwise we shouldn't fire duplicate periodic timeupdate events when the |
| 2463 // movie time hasn't changed. |
| 2464 if (!periodicEvent || (haveNotRecentlyFiredTimeupdate && movieTimeHasProgres
sed)) { |
| 2465 scheduleEvent(EventTypeNames::timeupdate); |
| 2466 m_lastTimeUpdateEventWallTime = now; |
| 2467 m_lastTimeUpdateEventMovieTime = movieTime; |
| 2468 } |
2463 } | 2469 } |
2464 | 2470 |
2465 bool HTMLMediaElement::togglePlayStateWillPlay() const | 2471 bool HTMLMediaElement::togglePlayStateWillPlay() const |
2466 { | 2472 { |
2467 if (m_mediaController) | 2473 if (m_mediaController) |
2468 return m_mediaController->paused() || m_mediaController->isRestrained(); | 2474 return m_mediaController->paused() || m_mediaController->isRestrained(); |
2469 return paused(); | 2475 return paused(); |
2470 } | 2476 } |
2471 | 2477 |
2472 void HTMLMediaElement::togglePlayState() | 2478 void HTMLMediaElement::togglePlayState() |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4009 | 4015 |
4010 #if ENABLE(WEB_AUDIO) | 4016 #if ENABLE(WEB_AUDIO) |
4011 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 4017 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
4012 { | 4018 { |
4013 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 4019 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
4014 audioSourceProvider()->setClient(0); | 4020 audioSourceProvider()->setClient(0); |
4015 } | 4021 } |
4016 #endif | 4022 #endif |
4017 | 4023 |
4018 } | 4024 } |
OLD | NEW |