Title: [247133] trunk/Source/WebCore
Revision
247133
Author
eric.carl...@apple.com
Date
2019-07-03 20:23:39 -0700 (Wed, 03 Jul 2019)

Log Message

[MSE] Add more debug and error logging
https://bugs.webkit.org/show_bug.cgi?id=199473
<rdar://problem/52615882>

Reviewed by Jer Noble.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::provideMediaData): Log if we don't enqueue every buffer.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal): Log if we return
without starting playback.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Log if
prerollDecodeWithCompletionHandler fails.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (247132 => 247133)


--- trunk/Source/WebCore/ChangeLog	2019-07-04 02:35:07 UTC (rev 247132)
+++ trunk/Source/WebCore/ChangeLog	2019-07-04 03:23:39 UTC (rev 247133)
@@ -1,3 +1,22 @@
+2019-07-03  Eric Carlson  <eric.carl...@apple.com>
+
+        [MSE] Add more debug and error logging
+        https://bugs.webkit.org/show_bug.cgi?id=199473
+        <rdar://problem/52615882>
+
+        Reviewed by Jer Noble.
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::provideMediaData): Log if we don't enqueue every buffer.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal): Log if we return
+        without starting playback.
+
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Log if 
+        prerollDecodeWithCompletionHandler fails.
+
 2019-07-03  Simon Fraser  <simon.fra...@apple.com>
 
         RELEASE_ASSERT in WebCore: WebCore::ScrollingStateTree::insertNode()

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (247132 => 247133)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2019-07-04 02:35:07 UTC (rev 247132)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2019-07-04 03:23:39 UTC (rev 247133)
@@ -2017,6 +2017,7 @@
 
     while (!trackBuffer.decodeQueue.empty()) {
         if (!m_private->isReadyForMoreSamples(trackID)) {
+            DEBUG_LOG(LOGIDENTIFIER, "bailing early, track id ", trackID, " is not ready for more data");
             m_private->notifyClientWhenReadyForMoreSamples(trackID);
             break;
         }
@@ -2036,8 +2037,11 @@
         MediaTime oneSecond(1, 1);
         if (trackBuffer.lastEnqueuedDecodeKey.first.isValid()
             && trackBuffer.lastEnqueuedDecodeDuration.isValid()
-            && sample->decodeTime() - trackBuffer.lastEnqueuedDecodeKey.first > oneSecond + trackBuffer.lastEnqueuedDecodeDuration)
+            && sample->decodeTime() - trackBuffer.lastEnqueuedDecodeKey.first > oneSecond + trackBuffer.lastEnqueuedDecodeDuration) {
+
+        DEBUG_LOG(LOGIDENTIFIER, "bailing early because of unbuffered gap, new sample: ", sample->decodeTime(), ", last enqueued sample ends: ", trackBuffer.lastEnqueuedDecodeKey.first + trackBuffer.lastEnqueuedDecodeDuration);
             break;
+        }
 
         // Remove the sample from the decode queue now.
         trackBuffer.decodeQueue.erase(trackBuffer.decodeQueue.begin());

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (247132 => 247133)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2019-07-04 02:35:07 UTC (rev 247132)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2019-07-04 03:23:39 UTC (rev 247133)
@@ -296,8 +296,10 @@
 
 void MediaPlayerPrivateMediaSourceAVFObjC::playInternal()
 {
-    if (currentMediaTime() >= m_mediaSourcePrivate->duration())
+    if (currentMediaTime() >= m_mediaSourcePrivate->duration()) {
+        ALWAYS_LOG(LOGIDENTIFIER, "bailing, current time: ", currentMediaTime(), " greater than duration ", m_mediaSourcePrivate->duration());
         return;
+    }
 
     ALWAYS_LOG(LOGIDENTIFIER);
     m_playing = true;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (247132 => 247133)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2019-07-04 02:35:07 UTC (rev 247132)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2019-07-04 03:23:39 UTC (rev 247133)
@@ -1098,13 +1098,14 @@
     if (platformSample.type != PlatformSample::CMSampleBufferType)
         return;
 
-    DEBUG_LOG(LOGIDENTIFIER, "track ID = ", trackID, ", sample = ", sample.get());
+    auto logSiteIdentifier = LOGIDENTIFIER;
+    DEBUG_LOG(logSiteIdentifier, "track ID = ", trackID, ", sample = ", sample.get());
 
     if (trackID == m_enabledVideoTrackID) {
         CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(platformSample.sample.cmSampleBuffer);
         FloatSize formatSize = FloatSize(CMVideoFormatDescriptionGetPresentationDimensions(formatDescription, true, true));
         if (!m_cachedSize || formatSize != m_cachedSize.value()) {
-            DEBUG_LOG(LOGIDENTIFIER, "size changed to ", formatSize);
+            DEBUG_LOG(logSiteIdentifier, "size changed to ", formatSize);
             bool sizeWasNull = !m_cachedSize;
             m_cachedSize = formatSize;
             if (m_mediaSource) {
@@ -1122,7 +1123,7 @@
             return;
 
         if (m_mediaSource && !m_mediaSource->player()->hasAvailableVideoFrame() && !sample->isNonDisplaying()) {
-            DEBUG_LOG(LOGIDENTIFIER, "adding buffer attachment");
+            DEBUG_LOG(logSiteIdentifier, "adding buffer attachment");
 
             bool havePrerollDecodeWithCompletionHandler = [PAL::getAVSampleBufferDisplayLayerClass() instancesRespondToSelector:@selector(prerollDecodeWithCompletionHandler:)];
 
@@ -1136,11 +1137,17 @@
                 m_mediaSource->player()->setHasAvailableVideoFrame(true);
 #endif
             } else {
+
                 [m_displayLayer enqueueSampleBuffer:platformSample.sample.cmSampleBuffer];
-                [m_displayLayer prerollDecodeWithCompletionHandler:[weakThis = makeWeakPtr(*this)] (BOOL success) mutable {
-                    if (!success || !weakThis)
+                [m_displayLayer prerollDecodeWithCompletionHandler:[this, logSiteIdentifier, weakThis = makeWeakPtr(*this)] (BOOL success) mutable {
+                    if (!weakThis)
                         return;
 
+                    if (!success) {
+                        ERROR_LOG(logSiteIdentifier, "prerollDecodeWithCompletionHandler failed");
+                        return;
+                    }
+
                     callOnMainThread([weakThis = WTFMove(weakThis)] () mutable {
                         if (!weakThis)
                             return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to