Title: [164318] trunk/Source/WebCore
Revision
164318
Author
eric.carl...@apple.com
Date
2014-02-18 14:24:29 -0800 (Tue, 18 Feb 2014)

Log Message

Do not cache media time until media engine returns a non-zero value
https://bugs.webkit.org/show_bug.cgi?id=128976

Reviewed by Jer Noble.

No new tests, covered by existing tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::refreshCachedTime): Don't mark the cached time as valid
    until it is non-zero.
(WebCore::HTMLMediaElement::currentTime): Return 0 if m_cachedTime is invalid.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164317 => 164318)


--- trunk/Source/WebCore/ChangeLog	2014-02-18 22:23:45 UTC (rev 164317)
+++ trunk/Source/WebCore/ChangeLog	2014-02-18 22:24:29 UTC (rev 164318)
@@ -1,3 +1,17 @@
+2014-02-18  Eric Carlson  <eric.carl...@apple.com>
+
+        Do not cache media time until media engine returns a non-zero value
+        https://bugs.webkit.org/show_bug.cgi?id=128976
+
+        Reviewed by Jer Noble.
+
+        No new tests, covered by existing tests.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::refreshCachedTime): Don't mark the cached time as valid
+            until it is non-zero.
+        (WebCore::HTMLMediaElement::currentTime): Return 0 if m_cachedTime is invalid.
+
 2014-02-17  Alexey Proskuryakov  <a...@apple.com>
 
         [iOS] All WebKit clients should encrypt WebCrypto keys automatically

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (164317 => 164318)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-02-18 22:23:45 UTC (rev 164317)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-02-18 22:24:29 UTC (rev 164318)
@@ -2439,10 +2439,18 @@
 void HTMLMediaElement::refreshCachedTime() const
 {
     m_cachedTime = m_player->currentTime();
+    if (!m_cachedTime) { 
+        // Do not use m_cachedTime until the media engine returns a non-zero value because we can't 
+        // estimate current time until playback actually begins. 
+        invalidateCachedTime(); 
+        return; 
+    } 
+
+    LOG(Media, "HTMLMediaElement::refreshCachedTime - caching time %f", m_cachedTime); 
     m_clockTimeAtLastCachedTimeUpdate = monotonicallyIncreasingTime();
 }
 
-void HTMLMediaElement::invalidateCachedTime()
+void HTMLMediaElement::invalidateCachedTime() const
 {
     LOG(Media, "HTMLMediaElement::invalidateCachedTime");
 
@@ -2509,6 +2517,9 @@
 
     refreshCachedTime();
 
+    if (m_cachedTime == MediaPlayer::invalidTime())
+        return 0;
+    
     return m_cachedTime;
 }
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (164317 => 164318)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2014-02-18 22:23:45 UTC (rev 164317)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2014-02-18 22:24:29 UTC (rev 164318)
@@ -653,7 +653,7 @@
     virtual void mediaCanStart() override;
 
     void setShouldDelayLoadEvent(bool);
-    void invalidateCachedTime();
+    void invalidateCachedTime() const;
     void refreshCachedTime() const;
 
     bool hasMediaControls() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to