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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 535703002: HTMLMediaElement shouldn't call currentTime() when we HAVE_NOTHING. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 m_seeking = false; 785 m_seeking = false;
786 786
787 // 4.7 - Set the current playback position to 0. 787 // 4.7 - Set the current playback position to 0.
788 // Set the official playback position to 0. 788 // Set the official playback position to 0.
789 // If this changed the official playback position, then queue a ta sk to fire a simple event named timeupdate at the media element. 789 // If this changed the official playback position, then queue a ta sk to fire a simple event named timeupdate at the media element.
790 // FIXME: Add support for firing this event. 790 // FIXME: Add support for firing this event.
791 791
792 // 4.8 - Set the initial playback position to 0. 792 // 4.8 - Set the initial playback position to 0.
793 // FIXME: Make this less subtle. The position only becomes 0 because of the createMediaPlayer() call 793 // FIXME: Make this less subtle. The position only becomes 0 because of the createMediaPlayer() call
794 // above. 794 // above.
795 refreshCachedTime(); 795 refreshCachedTime();
acolwell GONE FROM CHROMIUM 2014/09/03 00:21:42 I think you should be able to remove this call now
scherkus (not reviewing) 2014/09/03 03:27:45 Done ... it's tough to figure out the original int
796 invalidateCachedTime(); 796 invalidateCachedTime();
797 797
798 // 4.9 - Set the timeline offset to Not-a-Number (NaN). 798 // 4.9 - Set the timeline offset to Not-a-Number (NaN).
799 // 4.10 - Update the duration attribute to Not-a-Number (NaN). 799 // 4.10 - Update the duration attribute to Not-a-Number (NaN).
800 800
801 801
802 updateMediaController(); 802 updateMediaController();
803 updateActiveTextTrackCues(0); 803 updateActiveTextTrackCues(0);
804 } 804 }
805 805
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 return webMediaPlayer() && webMediaPlayer()->hasAudio(); 2040 return webMediaPlayer() && webMediaPlayer()->hasAudio();
2041 } 2041 }
2042 2042
2043 bool HTMLMediaElement::seeking() const 2043 bool HTMLMediaElement::seeking() const
2044 { 2044 {
2045 return m_seeking; 2045 return m_seeking;
2046 } 2046 }
2047 2047
2048 void HTMLMediaElement::refreshCachedTime() const 2048 void HTMLMediaElement::refreshCachedTime() const
2049 { 2049 {
2050 if (!webMediaPlayer()) 2050 if (!webMediaPlayer() || m_readyState < HAVE_METADATA)
2051 return; 2051 return;
2052 2052
2053 m_cachedTime = webMediaPlayer()->currentTime(); 2053 m_cachedTime = webMediaPlayer()->currentTime();
acolwell GONE FROM CHROMIUM 2014/09/03 00:21:42 nit: Add a comment indicating that this only conta
scherkus (not reviewing) 2014/09/03 03:27:44 Done in .h
2054 m_cachedTimeWallClockUpdateTime = WTF::currentTime(); 2054 m_cachedTimeWallClockUpdateTime = WTF::currentTime();
acolwell GONE FROM CHROMIUM 2014/09/03 00:21:42 Mind removing this while you are in here? The valu
scherkus (not reviewing) 2014/09/03 03:27:44 Done. I actually think we can nuke all this cache
2055 } 2055 }
2056 2056
2057 void HTMLMediaElement::invalidateCachedTime() 2057 void HTMLMediaElement::invalidateCachedTime()
2058 { 2058 {
2059 WTF_LOG(Media, "HTMLMediaElement::invalidateCachedTime"); 2059 WTF_LOG(Media, "HTMLMediaElement::invalidateCachedTime");
2060 2060
2061 // Don't try to cache movie time when playback first starts as the time repo rted by the engine 2061 // Don't try to cache movie time when playback first starts as the time repo rted by the engine
2062 // sometimes fluctuates for a short amount of time, so the cached time will be off if we take it 2062 // sometimes fluctuates for a short amount of time, so the cached time will be off if we take it
2063 // too early. 2063 // too early.
2064 static const double minimumTimePlayingBeforeCacheSnapshot = 0.5; 2064 static const double minimumTimePlayingBeforeCacheSnapshot = 0.5;
2065 2065
2066 m_minimumWallClockTimeToCacheMediaTime = WTF::currentTime() + minimumTimePla yingBeforeCacheSnapshot; 2066 m_minimumWallClockTimeToCacheMediaTime = WTF::currentTime() + minimumTimePla yingBeforeCacheSnapshot;
acolwell GONE FROM CHROMIUM 2014/09/03 00:21:42 ditto
scherkus (not reviewing) 2014/09/03 03:27:44 Done.
2067 m_cachedTime = MediaPlayer::invalidTime(); 2067 m_cachedTime = MediaPlayer::invalidTime();
2068 } 2068 }
2069 2069
2070 // playback state 2070 // playback state
2071 double HTMLMediaElement::currentTime() const 2071 double HTMLMediaElement::currentTime() const
2072 { 2072 {
2073 #if LOG_CACHED_TIME_WARNINGS 2073 #if LOG_CACHED_TIME_WARNINGS
2074 static const double minCachedDeltaForWarning = 0.01; 2074 static const double minCachedDeltaForWarning = 0.01;
acolwell GONE FROM CHROMIUM 2014/09/03 00:21:42 move this into the block below so we only have 1 #
scherkus (not reviewing) 2014/09/03 03:27:45 Done.
2075 #endif 2075 #endif
2076 2076
2077 if (m_readyState == HAVE_NOTHING) 2077 if (m_readyState == HAVE_NOTHING)
2078 return 0; 2078 return 0;
2079 2079
2080 if (m_seeking) { 2080 if (m_seeking) {
2081 WTF_LOG(Media, "HTMLMediaElement::currentTime - seeking, returning %f", m_lastSeekTime); 2081 WTF_LOG(Media, "HTMLMediaElement::currentTime - seeking, returning %f", m_lastSeekTime);
2082 return m_lastSeekTime; 2082 return m_lastSeekTime;
2083 } 2083 }
2084 2084
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
3409 m_networkState = NETWORK_IDLE; 3409 m_networkState = NETWORK_IDLE;
3410 3410
3411 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event. 3411 // 5 - Set the element's delaying-the-load-event flag to false. This stops d elaying the load event.
3412 setShouldDelayLoadEvent(false); 3412 setShouldDelayLoadEvent(false);
3413 3413
3414 // 6 - Abort the overall resource selection algorithm. 3414 // 6 - Abort the overall resource selection algorithm.
3415 m_currentSourceNode = nullptr; 3415 m_currentSourceNode = nullptr;
3416 3416
3417 // Reset m_readyState since m_player is gone. 3417 // Reset m_readyState since m_player is gone.
3418 m_readyState = HAVE_NOTHING; 3418 m_readyState = HAVE_NOTHING;
3419 updateMediaController(); 3419 updateMediaController();
acolwell GONE FROM CHROMIUM 2014/09/03 00:21:42 Add invalidateCachedTime() call here just to be co
scherkus (not reviewing) 2014/09/03 03:27:45 Done.
3420 updateActiveTextTrackCues(0); 3420 updateActiveTextTrackCues(0);
3421 } 3421 }
3422 3422
3423 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin g() 3423 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin g()
3424 { 3424 {
3425 #if ENABLE(WEB_AUDIO) 3425 #if ENABLE(WEB_AUDIO)
3426 if (audioSourceProvider()) 3426 if (audioSourceProvider())
3427 audioSourceProvider()->setClient(0); 3427 audioSourceProvider()->setClient(0);
3428 #endif 3428 #endif
3429 m_player.clear(); 3429 m_player.clear();
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
3989 3989
3990 #if ENABLE(WEB_AUDIO) 3990 #if ENABLE(WEB_AUDIO)
3991 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3991 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3992 { 3992 {
3993 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 3993 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3994 audioSourceProvider()->setClient(0); 3994 audioSourceProvider()->setClient(0);
3995 } 3995 }
3996 #endif 3996 #endif
3997 3997
3998 } 3998 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698