Title: [172507] trunk/Source/WebCore
- Revision
- 172507
- Author
- [email protected]
- Date
- 2014-08-12 16:40:27 -0700 (Tue, 12 Aug 2014)
Log Message
[MSE][Mac] Seeking to the very beginning of a buffered range stalls video playback
https://bugs.webkit.org/show_bug.cgi?id=135865
Reviewed by Eric Carlson.
AVSampleBufferRenderSynchronizer will report a current time of about 100ms or so before
the destination seek time when seeking. It does this in order to pre-roll the synchronized
audio renderer, but this can lead to playback stalling when MediaSource::monitorSourceBuffers()
looks at the media element's current time and determines that the current time is 100ms before
any buffered samples.
Clamp the value of currentMediaTime() to, at a minimum, the last requested seek time. This was
the suggested course of action from <rdar://problem/17789374>.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationDouble):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (172506 => 172507)
--- trunk/Source/WebCore/ChangeLog 2014-08-12 23:37:34 UTC (rev 172506)
+++ trunk/Source/WebCore/ChangeLog 2014-08-12 23:40:27 UTC (rev 172507)
@@ -1,5 +1,27 @@
2014-08-12 Jer Noble <[email protected]>
+ [MSE][Mac] Seeking to the very beginning of a buffered range stalls video playback
+ https://bugs.webkit.org/show_bug.cgi?id=135865
+
+ Reviewed by Eric Carlson.
+
+ AVSampleBufferRenderSynchronizer will report a current time of about 100ms or so before
+ the destination seek time when seeking. It does this in order to pre-roll the synchronized
+ audio renderer, but this can lead to playback stalling when MediaSource::monitorSourceBuffers()
+ looks at the media element's current time and determines that the current time is 100ms before
+ any buffered samples.
+
+ Clamp the value of currentMediaTime() to, at a minimum, the last requested seek time. This was
+ the suggested course of action from <rdar://problem/17789374>.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationDouble):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime):
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
+
+2014-08-12 Jer Noble <[email protected]>
+
[MSE] YouTube will lose audio, video after seeking backwards to an unbuffered range.
https://bugs.webkit.org/show_bug.cgi?id=135855
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (172506 => 172507)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2014-08-12 23:37:34 UTC (rev 172506)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2014-08-12 23:40:27 UTC (rev 172507)
@@ -195,6 +195,7 @@
Timer<MediaPlayerPrivateMediaSourceAVFObjC> m_seekTimer;
MediaPlayer::NetworkState m_networkState;
MediaPlayer::ReadyState m_readyState;
+ MediaTime m_lastSeekTime;
double m_rate;
bool m_playing;
bool m_seeking;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (172506 => 172507)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-08-12 23:37:34 UTC (rev 172506)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-08-12 23:40:27 UTC (rev 172507)
@@ -417,7 +417,12 @@
MediaTime MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime() const
{
- return std::max(MediaTime::zeroTime(), toMediaTime(CMTimebaseGetTime([m_synchronizer timebase])));
+ MediaTime synchronizerTime = toMediaTime(CMTimebaseGetTime([m_synchronizer timebase]));
+ if (synchronizerTime < MediaTime::zeroTime())
+ return MediaTime::zeroTime();
+ if (synchronizerTime < m_lastSeekTime)
+ return m_lastSeekTime;
+ return synchronizerTime;
}
double MediaPlayerPrivateMediaSourceAVFObjC::currentTimeDouble() const
@@ -463,16 +468,15 @@
if (!m_mediaSourcePrivate)
return;
- MediaTime seekTime;
if (pendingSeek->negativeThreshold == MediaTime::zeroTime() && pendingSeek->positiveThreshold == MediaTime::zeroTime())
- seekTime = pendingSeek->targetTime;
+ m_lastSeekTime = pendingSeek->targetTime;
else
- seekTime = m_mediaSourcePrivate->fastSeekTimeForMediaTime(pendingSeek->targetTime, pendingSeek->positiveThreshold, pendingSeek->negativeThreshold);
+ m_lastSeekTime = m_mediaSourcePrivate->fastSeekTimeForMediaTime(pendingSeek->targetTime, pendingSeek->positiveThreshold, pendingSeek->negativeThreshold);
- LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(%p) - seekTime(%s)", this, toString(seekTime).utf8().data());
+ LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(%p) - seekTime(%s)", this, toString(m_lastSeekTime).utf8().data());
- [m_synchronizer setRate:0 time:toCMTime(seekTime)];
- m_mediaSourcePrivate->seekToTime(seekTime);
+ [m_synchronizer setRate:0 time:toCMTime(m_lastSeekTime)];
+ m_mediaSourcePrivate->seekToTime(m_lastSeekTime);
}
void MediaPlayerPrivateMediaSourceAVFObjC::waitForSeekCompleted()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes