[MSE][Mac] Occasional image corruption after seeking
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2014 17:23:49 +0000 (17:23 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jun 2014 17:23:49 +0000 (17:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=133879

Reviewed by Eric Carlson.

Change the order of operations for seeks: change the current time of the AVSampleBufferRenderSynchronizer
before flushing and appending non-displaying samples.

Rather than having a single function which retrieves the fast seek time and then seeks, split this out
into two functions: one which gets the fast seek time, and one which seeks. (The later of course already
exists: seekToTime()).

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
(WebCore::MediaSourcePrivateAVFObjC::fastSeekTimeForMediaTime): Renamed from seekToTime()
(WebCore::MediaSourcePrivateAVFObjC::seekToTime): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170014 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm

index 8e01ffa..9005ccc 100644 (file)
@@ -1,3 +1,25 @@
+2014-06-16  Jer Noble  <jer.noble@apple.com>
+
+        [MSE][Mac] Occasional image corruption after seeking
+        https://bugs.webkit.org/show_bug.cgi?id=133879
+
+        Reviewed by Eric Carlson.
+
+        Change the order of operations for seeks: change the current time of the AVSampleBufferRenderSynchronizer
+        before flushing and appending non-displaying samples.
+
+        Rather than having a single function which retrieves the fast seek time and then seeks, split this out
+        into two functions: one which gets the fast seek time, and one which seeks. (The later of course already
+        exists: seekToTime()).
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
+        * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
+        * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
+        (WebCore::MediaSourcePrivateAVFObjC::fastSeekTimeForMediaTime): Renamed from seekToTime()
+        (WebCore::MediaSourcePrivateAVFObjC::seekToTime): Deleted.
+
 2014-06-16  Zan Dobersek  <zdobersek@igalia.com>
 
         Have ScriptExecutionContext::Task functions take in a ScriptExecutionContext reference
index bed62d6..d6724d8 100644 (file)
@@ -436,13 +436,14 @@ void MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(double time, double nega
     if (!m_mediaSourcePrivate)
         return;
 
-    MediaTime seekTime = MediaTime::createWithDouble(time);
+    MediaTime seekTime;
     if (!negativeThreshold && !positiveThreshold)
-        m_mediaSourcePrivate->seekToTime(seekTime);
+        seekTime = MediaTime::createWithDouble(time);
     else
-        seekTime = m_mediaSourcePrivate->seekToTime(seekTime, MediaTime::createWithDouble(positiveThreshold), MediaTime::createWithDouble(negativeThreshold));
+        seekTime = m_mediaSourcePrivate->fastSeekTimeForMediaTime(MediaTime::createWithDouble(time), MediaTime::createWithDouble(positiveThreshold), MediaTime::createWithDouble(negativeThreshold));
 
     [m_synchronizer setRate:(m_playing ? m_rate : 0) time:toCMTime(seekTime)];
+    m_mediaSourcePrivate->seekToTime(seekTime);
 }
 
 bool MediaPlayerPrivateMediaSourceAVFObjC::seeking() const
index 34fdadc..2a811e9 100644 (file)
@@ -68,7 +68,7 @@ public:
     bool hasVideo() const;
 
     void seekToTime(MediaTime);
-    MediaTime seekToTime(MediaTime, MediaTime negativeThreshold, MediaTime positiveThreshold);
+    MediaTime fastSeekTimeForMediaTime(MediaTime, MediaTime negativeThreshold, MediaTime positiveThreshold);
     IntSize naturalSize() const;
 
 #if ENABLE(ENCRYPTED_MEDIA_V2)
index c8db209..1faf197 100644 (file)
@@ -184,7 +184,7 @@ void MediaSourcePrivateAVFObjC::seekToTime(MediaTime time)
         buffer->seekToTime(time);
 }
 
-MediaTime MediaSourcePrivateAVFObjC::seekToTime(MediaTime targetTime, MediaTime negativeThreshold, MediaTime positiveThreshold)
+MediaTime MediaSourcePrivateAVFObjC::fastSeekTimeForMediaTime(MediaTime targetTime, MediaTime negativeThreshold, MediaTime positiveThreshold)
 {
     MediaTime seekTime = targetTime;
 
@@ -194,8 +194,6 @@ MediaTime MediaSourcePrivateAVFObjC::seekToTime(MediaTime targetTime, MediaTime
             seekTime = sourceSeekTime;
     }
 
-    seekToTime(seekTime);
-
     return seekTime;
 }