Title: [171017] trunk/Source/WebCore
Revision
171017
Author
[email protected]
Date
2014-07-11 17:53:44 -0700 (Fri, 11 Jul 2014)

Log Message

[MSE] Separate MediaSource logging into its own log channel
https://bugs.webkit.org/show_bug.cgi?id=134809

Reviewed by Eric Carlson.

Separate out MediaSource logging (which can be quite verbose) into its own log channel,
distinct from the Media log channel. Add some per-sample logging and further sequester that
logging into its own MediaSourceSamples log channel.

Add the MediaSource and MediaSourceSamples channels:
* platform/Logging.h:

Move LOG(Media) -> LOG(MediaSource):
* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::MediaSource):
(WebCore::MediaSource::~MediaSource):
(WebCore::MediaSource::setReadyState):
(WebCore::MediaSource::addSourceBuffer):
(WebCore::MediaSource::removeSourceBuffer):
(WebCore::MediaSource::isTypeSupported):
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateSeekToTime):
(WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
(WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
(WebCore::SourceBuffer::provideMediaData):
(WebCore::SourceBuffer::monitorBufferingRate):
(WebCore::SourceBuffer::textTrackAddCues):
(WebCore::SourceBuffer::hasFutureTime):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
(WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError):
(WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
(WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
(WebCore::SourceBufferPrivateAVFObjC::append):
(WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
(WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):
(WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (171016 => 171017)


--- trunk/Source/WebCore/ChangeLog	2014-07-11 23:54:55 UTC (rev 171016)
+++ trunk/Source/WebCore/ChangeLog	2014-07-12 00:53:44 UTC (rev 171017)
@@ -1,3 +1,45 @@
+2014-07-11  Jer Noble  <[email protected]>
+
+        [MSE] Separate MediaSource logging into its own log channel
+        https://bugs.webkit.org/show_bug.cgi?id=134809
+
+        Reviewed by Eric Carlson.
+
+        Separate out MediaSource logging (which can be quite verbose) into its own log channel,
+        distinct from the Media log channel. Add some per-sample logging and further sequester that
+        logging into its own MediaSourceSamples log channel.
+
+        Add the MediaSource and MediaSourceSamples channels:
+        * platform/Logging.h:
+
+        Move LOG(Media) -> LOG(MediaSource):
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::MediaSource):
+        (WebCore::MediaSource::~MediaSource):
+        (WebCore::MediaSource::setReadyState):
+        (WebCore::MediaSource::addSourceBuffer):
+        (WebCore::MediaSource::removeSourceBuffer):
+        (WebCore::MediaSource::isTypeSupported):
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::sourceBufferPrivateSeekToTime):
+        (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
+        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
+        (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples):
+        (WebCore::SourceBuffer::provideMediaData):
+        (WebCore::SourceBuffer::monitorBufferingRate):
+        (WebCore::SourceBuffer::textTrackAddCues):
+        (WebCore::SourceBuffer::hasFutureTime):
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
+        (WebCore::SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError):
+        (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
+        (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
+        (WebCore::SourceBufferPrivateAVFObjC::append):
+        (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError):
+        (WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):
+        (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples):
+        (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
+
 2014-07-11  Brady Eidson  <[email protected]>
 
         Phone numbers that span two lines are not detected.

Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (171016 => 171017)


--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp	2014-07-11 23:54:55 UTC (rev 171016)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp	2014-07-12 00:53:44 UTC (rev 171017)
@@ -79,14 +79,14 @@
     , m_readyState(closedKeyword())
     , m_asyncEventQueue(*this)
 {
-    LOG(Media, "MediaSource::MediaSource %p", this);
+    LOG(MediaSource, "MediaSource::MediaSource %p", this);
     m_sourceBuffers = SourceBufferList::create(scriptExecutionContext());
     m_activeSourceBuffers = SourceBufferList::create(scriptExecutionContext());
 }
 
 MediaSource::~MediaSource()
 {
-    LOG(Media, "MediaSource::~MediaSource %p", this);
+    LOG(MediaSource, "MediaSource::~MediaSource %p", this);
     ASSERT(isClosed());
 }
 
@@ -292,7 +292,7 @@
     ASSERT(state == openKeyword() || state == closedKeyword() || state == endedKeyword());
 
     AtomicString oldState = readyState();
-    LOG(Media, "MediaSource::setReadyState() %p : %s -> %s", this, oldState.string().ascii().data(), state.string().ascii().data());
+    LOG(MediaSource, "MediaSource::setReadyState() %p : %s -> %s", this, oldState.string().ascii().data(), state.string().ascii().data());
 
     if (state == closedKeyword()) {
         m_private.clear();
@@ -400,7 +400,7 @@
 
 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionCode& ec)
 {
-    LOG(Media, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this);
+    LOG(MediaSource, "MediaSource::addSourceBuffer(%s) %p", type.ascii().data(), this);
 
     // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type
     // 1. If type is null or an empty then throw an INVALID_ACCESS_ERR exception and
@@ -447,7 +447,7 @@
 
 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionCode& ec)
 {
-    LOG(Media, "MediaSource::removeSourceBuffer() %p", this);
+    LOG(MediaSource, "MediaSource::removeSourceBuffer() %p", this);
     RefPtr<SourceBuffer> protect(buffer);
 
     // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer
@@ -602,7 +602,7 @@
 
 bool MediaSource::isTypeSupported(const String& type)
 {
-    LOG(Media, "MediaSource::isTypeSupported(%s)", type.ascii().data());
+    LOG(MediaSource, "MediaSource::isTypeSupported(%s)", type.ascii().data());
 
     // Section 2.2 isTypeSupported() method steps.
     // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (171016 => 171017)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2014-07-11 23:54:55 UTC (rev 171016)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2014-07-12 00:53:44 UTC (rev 171017)
@@ -310,7 +310,7 @@
 
 void SourceBuffer::sourceBufferPrivateSeekToTime(SourceBufferPrivate*, const MediaTime& time)
 {
-    LOG(Media, "SourceBuffer::sourceBufferPrivateSeekToTime(%p) - time(%s)", this, toString(time).utf8().data());
+    LOG(MediaSource, "SourceBuffer::sourceBufferPrivateSeekToTime(%p) - time(%s)", this, toString(time).utf8().data());
 
     for (auto& trackBufferPair : m_trackBufferMap) {
         TrackBuffer& trackBuffer = trackBufferPair.value;
@@ -505,7 +505,7 @@
         const AtomicString& trackID = trackBufferPair.key;
 
         if (trackBuffer.needsReenqueueing) {
-            LOG(Media, "SourceBuffer::sourceBufferPrivateAppendComplete(%p) - reenqueuing at time (%s)", this, toString(currentMediaTime).utf8().data());
+            LOG(MediaSource, "SourceBuffer::sourceBufferPrivateAppendComplete(%p) - reenqueuing at time (%s)", this, toString(currentMediaTime).utf8().data());
             reenqueueMediaForTime(trackBuffer, trackID, currentMediaTime);
         } else
             provideMediaData(trackBuffer, trackID);
@@ -1162,6 +1162,7 @@
                 MediaTime startTime = samplePair.second->presentationTime();
                 MediaTime endTime = startTime + samplePair.second->duration() + microsecond;
                 erasedRanges->add(startTime.toDouble(), endTime.toDouble());
+                LOG(MediaSource, "SourceBuffer::sourceBufferPrivateDidReceiveSample(%p) - removing sample(%s)", this, toString(*samplePair.second).utf8().data());
                 trackBuffer.samples.removeSample(samplePair.second.get());
             }
 
@@ -1327,7 +1328,7 @@
 
 void SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples(SourceBufferPrivate*, AtomicString trackID)
 {
-    LOG(Media, "SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples(%p)", this);
+    LOG(MediaSource, "SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples(%p)", this);
     auto it = m_trackBufferMap.find(trackID);
     if (it == m_trackBufferMap.end())
         return;
@@ -1358,7 +1359,7 @@
     }
     trackBuffer.decodeQueue.erase(trackBuffer.decodeQueue.begin(), sampleIt);
 
-    LOG(Media, "SourceBuffer::provideMediaData(%p) - Enqueued %u samples", this, enqueuedSamples);
+    LOG(MediaSource, "SourceBuffer::provideMediaData(%p) - Enqueued %u samples", this, enqueuedSamples);
 }
 
 void SourceBuffer::reenqueueMediaForTime(TrackBuffer& trackBuffer, AtomicString trackID, const MediaTime& time)
@@ -1421,7 +1422,7 @@
 
     m_averageBufferRate = m_averageBufferRate * (1 - ExponentialMovingAverageCoefficient) + rateSinceLastMonitor * ExponentialMovingAverageCoefficient;
 
-    LOG(Media, "SourceBuffer::monitorBufferingRate(%p) - m_avegareBufferRate: %lf", this, m_averageBufferRate);
+    LOG(MediaSource, "SourceBuffer::monitorBufferingRate(%p) - m_avegareBufferRate: %lf", this, m_averageBufferRate);
 }
 
 bool SourceBuffer::hasCurrentTime() const

Modified: trunk/Source/WebCore/platform/Logging.h (171016 => 171017)


--- trunk/Source/WebCore/platform/Logging.h	2014-07-11 23:54:55 UTC (rev 171016)
+++ trunk/Source/WebCore/platform/Logging.h	2014-07-12 00:53:44 UTC (rev 171017)
@@ -54,6 +54,8 @@
     M(LiveConnect) \
     M(Loading) \
     M(Media) \
+    M(MediaSource) \
+    M(MediaSourceSamples) \
     M(MemoryPressure) \
     M(Network) \
     M(NotYetImplemented) \

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-07-11 23:54:55 UTC (rev 171016)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-07-12 00:53:44 UTC (rev 171017)
@@ -568,7 +568,7 @@
 
 void SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset(AVAsset* asset)
 {
-    LOG(Media, "SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset(%p)", this);
+    LOG(MediaSource, "SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset(%p)", this);
 
     m_asset = asset;
 
@@ -607,7 +607,7 @@
 #if LOG_DISABLED
     UNUSED_PARAM(error);
 #endif
-    LOG(Media, "SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError(%p) - error:\"%s\"", this, String([error description]).utf8().data());
+    LOG(MediaSource, "SourceBufferPrivateAVFObjC::didFailToParseStreamDataWithError(%p) - error:\"%s\"", this, String([error description]).utf8().data());
 
     m_parsingSucceeded = false;
 }
@@ -631,15 +631,20 @@
         CMFormatDescriptionRef formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer);
         FloatSize formatSize = FloatSize(CMVideoFormatDescriptionGetPresentationDimensions(formatDescription, true, true));
         if (formatSize != m_cachedSize) {
-            LOG(Media, "SourceBufferPrivateAVFObjC::processCodedFrame(%p) - size change detected: {width=%lf, height=%lf", formatSize.width(), formatSize.height());
+            LOG(MediaSource, "SourceBufferPrivateAVFObjC::processCodedFrame(%p) - size change detected: {width=%lf, height=%lf", formatSize.width(), formatSize.height());
             m_cachedSize = formatSize;
             if (m_mediaSource)
                 m_mediaSource->player()->sizeChanged();
         }
     }
-    if (m_client)
-        m_client->sourceBufferPrivateDidReceiveSample(this, MediaSampleAVFObjC::create(sampleBuffer, trackID));
 
+
+    if (m_client) {
+        RefPtr<MediaSample> mediaSample = MediaSampleAVFObjC::create(sampleBuffer, trackID);
+        LOG(MediaSourceSamples, "SourceBufferPrivateAVFObjC::processCodedFrame(%p) - sample(%s)", this, toString(*mediaSample).utf8().data());
+        m_client->sourceBufferPrivateDidReceiveSample(this, mediaSample.release());
+    }
+
     return true;
 }
 
@@ -657,7 +662,7 @@
 
     UNUSED_PARAM(trackID);
 #if ENABLE(ENCRYPTED_MEDIA_V2)
-    LOG(Media, "SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID(%p) - track:%d", this, trackID);
+    LOG(MediaSource, "SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID(%p) - track:%d", this, trackID);
     m_protectedTrackID = trackID;
     RefPtr<Uint8Array> initDataArray = Uint8Array::create([initData length]);
     [initData getBytes:initDataArray->data() length:initDataArray->length()];
@@ -684,7 +689,7 @@
 
 void SourceBufferPrivateAVFObjC::append(const unsigned char* data, unsigned length)
 {
-    LOG(Media, "SourceBufferPrivateAVFObjC::append(%p) - data:%p, length:%d", this, data, length);
+    LOG(MediaSource, "SourceBufferPrivateAVFObjC::append(%p) - data:%p, length:%d", this, data, length);
 
     RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytes:data length:length]);
     WeakPtr<SourceBufferPrivateAVFObjC> weakThis = createWeakPtr();
@@ -860,7 +865,7 @@
 
 void SourceBufferPrivateAVFObjC::layerDidReceiveError(AVSampleBufferDisplayLayer *layer, NSError *error)
 {
-    LOG(Media, "SourceBufferPrivateAVFObjC::layerDidReceiveError(%p): layer(%p), error(%@)", this, layer, [error description]);
+    LOG(MediaSource, "SourceBufferPrivateAVFObjC::layerDidReceiveError(%p): layer(%p), error(%@)", this, layer, [error description]);
     for (auto& client : m_errorClients)
         client->layerDidReceiveError(layer, error);
 
@@ -872,7 +877,7 @@
 
 void SourceBufferPrivateAVFObjC::rendererDidReceiveError(AVSampleBufferAudioRenderer *renderer, NSError *error)
 {
-    LOG(Media, "SourceBufferPrivateAVFObjC::rendererDidReceiveError(%p): renderer(%p), error(%@)", this, renderer, [error description]);
+    LOG(MediaSource, "SourceBufferPrivateAVFObjC::rendererDidReceiveError(%p): renderer(%p), error(%@)", this, renderer, [error description]);
     for (auto& client : m_errorClients)
         client->rendererDidReceiveError(renderer, error);
 }
@@ -896,7 +901,7 @@
 void SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>> mediaSamples, AtomicString trackIDString)
 {
     int trackID = trackIDString.toInt();
-    LOG(Media, "SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples(%p) samples: %d samples, trackId: %d", this, mediaSamples.size(), trackID);
+    LOG(MediaSource, "SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples(%p) samples: %d samples, trackId: %d", this, mediaSamples.size(), trackID);
 
     if (trackID == m_enabledVideoTrackID)
         flushAndEnqueueNonDisplayingSamples(mediaSamples, m_displayLayer.get());
@@ -927,6 +932,8 @@
     for (auto it = mediaSamples.begin(), end = mediaSamples.end(); it != end; ++it) {
         RefPtr<MediaSample>& mediaSample = *it;
 
+        LOG(MediaSourceSamples, "SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples(%p) - sample(%s)", this, toString(*mediaSample).utf8().data());
+
         PlatformSample platformSample = mediaSample->platformSample();
         ASSERT(platformSample.type == PlatformSample::CMSampleBufferType);
 
@@ -951,6 +958,8 @@
     if (platformSample.type != PlatformSample::CMSampleBufferType)
         return;
 
+    LOG(MediaSourceSamples, "SourceBufferPrivateAVFObjC::enqueueSample(%p) - sample(%s)", this, toString(*mediaSample).utf8().data());
+
     if (trackID == m_enabledVideoTrackID) {
         [m_displayLayer enqueueSampleBuffer:platformSample.sample.cmSampleBuffer];
         if (m_mediaSource)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to