- Revision
- 221937
- Author
- jer.no...@apple.com
- Date
- 2017-09-12 13:14:57 -0700 (Tue, 12 Sep 2017)
Log Message
[MSE] Don't increase the reported totalFrameDelay for non-displayed frames (or frames coming in while paused).
https://bugs.webkit.org/show_bug.cgi?id=175900
Reviewed by Eric Carlson.
When seeking to a specific time, the decompression session necessarily needs to be fed samples from before that
time (i.e., all samples from the previous I-frame forward). These shouldn't contribute to the "total frame
delay" metric. Neither should samples delivered when the video is paused (like, during seeking), as a frame can't
be "late" if time is not moving forward.
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
* platform/cf/CoreMediaSoftLink.cpp:
* platform/cf/CoreMediaSoftLink.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (221936 => 221937)
--- trunk/Source/WebCore/ChangeLog 2017-09-12 20:03:43 UTC (rev 221936)
+++ trunk/Source/WebCore/ChangeLog 2017-09-12 20:14:57 UTC (rev 221937)
@@ -1,3 +1,20 @@
+2017-09-12 Jer Noble <jer.no...@apple.com>
+
+ [MSE] Don't increase the reported totalFrameDelay for non-displayed frames (or frames coming in while paused).
+ https://bugs.webkit.org/show_bug.cgi?id=175900
+
+ Reviewed by Eric Carlson.
+
+ When seeking to a specific time, the decompression session necessarily needs to be fed samples from before that
+ time (i.e., all samples from the previous I-frame forward). These shouldn't contribute to the "total frame
+ delay" metric. Neither should samples delivered when the video is paused (like, during seeking), as a frame can't
+ be "late" if time is not moving forward.
+
+ * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+ (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
+ * platform/cf/CoreMediaSoftLink.cpp:
+ * platform/cf/CoreMediaSoftLink.h:
+
2017-09-12 Sam Weinig <s...@webkit.org>
Gtk build fix for "Finish off the FormData implementation" - https://bugs.webkit.org/show_bug.cgi?id=176659
Modified: trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp (221936 => 221937)
--- trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp 2017-09-12 20:03:43 UTC (rev 221936)
+++ trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.cpp 2017-09-12 20:14:57 UTC (rev 221937)
@@ -102,6 +102,7 @@
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMSetAttachment, void, (CMAttachmentBearerRef target, CFStringRef key, CFTypeRef value, CMAttachmentMode attachmentMode), (target, key, value, attachmentMode))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimebaseCreateWithMasterClock, OSStatus, (CFAllocatorRef allocator, CMClockRef masterClock, CMTimebaseRef *timebaseOut), (allocator, masterClock, timebaseOut))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimebaseGetTime, CMTime, (CMTimebaseRef timebase), (timebase))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimebaseGetRate, Float64, (CMTimebaseRef timebase), (timebase))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimebaseSetRate, OSStatus, (CMTimebaseRef timebase, Float64 rate), (timebase, rate))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimebaseSetTime, OSStatus, (CMTimebaseRef timebase, CMTime time), (timebase, time))
SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreMedia, CMTimebaseGetEffectiveRate, Float64, (CMTimebaseRef timebase), (timebase))
Modified: trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h (221936 => 221937)
--- trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h 2017-09-12 20:03:43 UTC (rev 221936)
+++ trunk/Source/WebCore/platform/cf/CoreMediaSoftLink.h 2017-09-12 20:14:57 UTC (rev 221937)
@@ -163,6 +163,8 @@
#define CMTimebaseCreateWithMasterClock softLink_CoreMedia_CMTimebaseCreateWithMasterClock
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimebaseGetTime, CMTime, (CMTimebaseRef timebase), (timebase))
#define CMTimebaseGetTime softLink_CoreMedia_CMTimebaseGetTime
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimebaseGetRate, Float64, (CMTimebaseRef timebase), (timebase))
+#define CMTimebaseGetRate softLink_CoreMedia_CMTimebaseGetRate
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimebaseSetRate, OSStatus, (CMTimebaseRef timebase, Float64 rate), (timebase, rate))
#define CMTimebaseSetRate softLink_CoreMedia_CMTimebaseSetRate
SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreMedia, CMTimebaseSetTime, OSStatus, (CMTimebaseRef timebase, CMTime time), (timebase, time))
Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm (221936 => 221937)
--- trunk/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm 2017-09-12 20:03:43 UTC (rev 221936)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm 2017-09-12 20:14:57 UTC (rev 221937)
@@ -279,9 +279,12 @@
return;
}
- auto currentTime = CMTimebaseGetTime(m_timebase.get());
- if (m_timebase && CMTimeCompare(presentationTimeStamp, currentTime) < 0)
- m_totalFrameDelay += toMediaTime(CMTimeSubtract(currentTime, presentationTimeStamp));
+ if (displaying && m_timebase) {
+ auto currentTime = CMTimebaseGetTime(m_timebase.get());
+ auto currentRate = CMTimebaseGetRate(m_timebase.get());
+ if (currentRate > 0 && CMTimeCompare(presentationTimeStamp, currentTime) < 0)
+ m_totalFrameDelay += toMediaTime(CMTimeSubtract(currentTime, presentationTimeStamp));
+ }
dispatch_async(m_enqueingQueue.get(), [protectedThis = makeRefPtr(this), status, imageSampleBuffer = adoptCF(rawImageSampleBuffer), infoFlags, displaying] {
UNUSED_PARAM(infoFlags);