Title: [169099] branches/safari-538.34-branch/Source/WebCore

Diff

Modified: branches/safari-538.34-branch/Source/WebCore/ChangeLog (169098 => 169099)


--- branches/safari-538.34-branch/Source/WebCore/ChangeLog	2014-05-20 02:49:33 UTC (rev 169098)
+++ branches/safari-538.34-branch/Source/WebCore/ChangeLog	2014-05-20 02:56:33 UTC (rev 169099)
@@ -1,5 +1,9 @@
 2014-05-19  Matthew Hanson  <[email protected]>
 
+        Rollout r169074.
+
+2014-05-19  Matthew Hanson  <[email protected]>
+
         Merge r169037.
 
     2014-05-18  Brent Fulgham  <[email protected]>

Modified: branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (169098 => 169099)


--- branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2014-05-20 02:49:33 UTC (rev 169098)
+++ branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2014-05-20 02:56:33 UTC (rev 169099)
@@ -107,6 +107,7 @@
     , m_pendingRemoveEnd(MediaTime::invalidTime())
     , m_removeTimer(this, &SourceBuffer::removeTimerFired)
 {
+    ASSERT(m_private);
     ASSERT(m_source);
 
     m_private->setClient(this);
@@ -473,7 +474,7 @@
 
     // 1. Loop Top: If the input buffer is empty, then jump to the need more data step below.
     if (!m_pendingAppendData.size()) {
-        sourceBufferPrivateAppendComplete(&m_private.get(), AppendSucceeded);
+        sourceBufferPrivateAppendComplete(m_private.get(), AppendSucceeded);
         return;
     }
 

Modified: branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.h (169098 => 169099)


--- branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.h	2014-05-20 02:49:33 UTC (rev 169098)
+++ branches/safari-538.34-branch/Source/WebCore/Modules/mediasource/SourceBuffer.h	2014-05-20 02:56:33 UTC (rev 169099)
@@ -156,7 +156,7 @@
     void removeTimerFired(Timer<SourceBuffer>*);
     void removeCodedFrames(const MediaTime& start, const MediaTime& end);
 
-    Ref<SourceBufferPrivate> m_private;
+    RefPtr<SourceBufferPrivate> m_private;
     MediaSource* m_source;
     GenericEventQueue m_asyncEventQueue;
 

Modified: branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm (169098 => 169099)


--- branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm	2014-05-20 02:49:33 UTC (rev 169098)
+++ branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm	2014-05-20 02:56:33 UTC (rev 169099)
@@ -85,7 +85,6 @@
         m_activeSourceBuffers.remove(pos);
 
     pos = m_sourceBuffers.find(buffer);
-    m_sourceBuffers[pos]->clearMediaSource();
     m_sourceBuffers.remove(pos);
 }
 
@@ -158,8 +157,9 @@
 }
 #endif
 
-static bool MediaSourcePrivateAVFObjCHasAudio(SourceBufferPrivateAVFObjC* sourceBuffer)
+static bool MediaSourcePrivateAVFObjCHasAudio(PassRefPtr<SourceBufferPrivateAVFObjC> prpSourceBuffer)
 {
+    RefPtr<SourceBufferPrivateAVFObjC> sourceBuffer = prpSourceBuffer;
     return sourceBuffer->hasAudio();
 }
 
@@ -168,8 +168,9 @@
     return std::any_of(m_activeSourceBuffers.begin(), m_activeSourceBuffers.end(), MediaSourcePrivateAVFObjCHasAudio);
 }
 
-static bool MediaSourcePrivateAVFObjCHasVideo(SourceBufferPrivateAVFObjC* sourceBuffer)
+static bool MediaSourcePrivateAVFObjCHasVideo(PassRefPtr<SourceBufferPrivateAVFObjC> prpSourceBuffer)
 {
+    RefPtr<SourceBufferPrivateAVFObjC> sourceBuffer = prpSourceBuffer;
     return sourceBuffer->hasVideo();
 }
 

Modified: branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h (169098 => 169099)


--- branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h	2014-05-20 02:49:33 UTC (rev 169098)
+++ branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h	2014-05-20 02:56:33 UTC (rev 169099)
@@ -36,7 +36,6 @@
 #include <wtf/RefPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
-#include <wtf/WeakPtr.h>
 #include <wtf/text/AtomicString.h>
 
 OBJC_CLASS AVAsset;
@@ -114,13 +113,9 @@
     void destroyParser();
     void destroyRenderers();
 
-    WeakPtr<SourceBufferPrivateAVFObjC> createWeakPtr() { return m_weakFactory.createWeakPtr(); }
-
     Vector<RefPtr<VideoTrackPrivateMediaSourceAVFObjC>> m_videoTracks;
     Vector<RefPtr<AudioTrackPrivateMediaSourceAVFObjC>> m_audioTracks;
 
-    WeakPtrFactory<SourceBufferPrivateAVFObjC> m_weakFactory;
-
     RetainPtr<AVStreamDataParser> m_parser;
     RetainPtr<AVAsset> m_asset;
     RetainPtr<AVSampleBufferDisplayLayer> m_displayLayer;

Modified: branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (169098 => 169099)


--- branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-05-20 02:49:33 UTC (rev 169098)
+++ branches/safari-538.34-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-05-20 02:56:33 UTC (rev 169099)
@@ -153,14 +153,14 @@
 #pragma mark WebAVStreamDataParserListener
 
 @interface WebAVStreamDataParserListener : NSObject {
-    WeakPtr<WebCore::SourceBufferPrivateAVFObjC> _parent;
+    WebCore::SourceBufferPrivateAVFObjC* _parent;
     AVStreamDataParser* _parser;
 }
-- (id)initWithParser:(AVStreamDataParser*)parser parent:(WeakPtr<WebCore::SourceBufferPrivateAVFObjC>)parent;
+- (id)initWithParser:(AVStreamDataParser*)parser parent:(WebCore::SourceBufferPrivateAVFObjC*)parent;
 @end
 
 @implementation WebAVStreamDataParserListener
-- (id)initWithParser:(AVStreamDataParser*)parser parent:(WeakPtr<WebCore::SourceBufferPrivateAVFObjC>)parent
+- (id)initWithParser:(AVStreamDataParser*)parser parent:(WebCore::SourceBufferPrivateAVFObjC*)parent
 {
     self = [super init];
     if (!self)
@@ -182,6 +182,7 @@
 - (void)invalidate
 {
     [_parser setDelegate:nil];
+    _parent = nullptr;
     _parser = nullptr;
 }
 
@@ -191,12 +192,13 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> strongSelf = self;
+    RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent;
+    if (!strongParent)
+        return;
 
     RetainPtr<AVAsset*> strongAsset = asset;
-    callOnMainThread([strongSelf, strongAsset] {
-        if (strongSelf->_parent)
-            strongSelf->_parent->didParseStreamDataAsAsset(strongAsset.get());
+    callOnMainThread([strongParent, strongAsset] {
+        strongParent->didParseStreamDataAsAsset(strongAsset.get());
     });
 }
 
@@ -207,12 +209,13 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> strongSelf = self;
+    RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent;
+    if (!strongParent)
+        return;
 
     RetainPtr<AVAsset*> strongAsset = asset;
-    callOnMainThread([strongSelf, strongAsset] {
-        if (strongSelf->_parent)
-            strongSelf->_parent->didParseStreamDataAsAsset(strongAsset.get());
+    callOnMainThread([strongParent, strongAsset] {
+        strongParent->didParseStreamDataAsAsset(strongAsset.get());
     });
 }
 
@@ -222,12 +225,13 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> strongSelf = self;
+    RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent;
+    if (!strongParent)
+        return;
 
     RetainPtr<NSError> strongError = error;
-    callOnMainThread([strongSelf, strongError] {
-        if (strongSelf->_parent)
-            strongSelf->_parent->didFailToParseStreamDataWithError(strongError.get());
+    callOnMainThread([strongParent, strongError] {
+        strongParent->didFailToParseStreamDataWithError(strongError.get());
     });
 }
 
@@ -237,13 +241,14 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> strongSelf = self;
+    RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent;
+    if (!strongParent)
+        return;
 
     RetainPtr<CMSampleBufferRef> strongSample = sample;
     String mediaType = nsMediaType;
-    callOnMainThread([strongSelf, strongSample, trackID, mediaType, flags] {
-        if (strongSelf->_parent)
-            strongSelf->_parent->didProvideMediaDataForTrackID(trackID, strongSample.get(), mediaType, flags);
+    callOnMainThread([strongParent, strongSample, trackID, mediaType, flags] {
+        strongParent->didProvideMediaDataForTrackID(trackID, strongSample.get(), mediaType, flags);
     });
 }
 
@@ -253,12 +258,13 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> strongSelf = self;
+    RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent;
+    if (!strongParent)
+        return;
 
     String mediaType = nsMediaType;
-    callOnMainThread([strongSelf, trackID, mediaType] {
-        if (strongSelf->_parent)
-            strongSelf->_parent->didReachEndOfTrackWithTrackID(trackID, mediaType);
+    callOnMainThread([strongParent, trackID, mediaType] {
+        strongParent->didReachEndOfTrackWithTrackID(trackID, mediaType);
     });
 }
 
@@ -268,12 +274,13 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> strongSelf = self;
+    RefPtr<WebCore::SourceBufferPrivateAVFObjC> strongParent = _parent;
+    if (!strongParent)
+        return;
 
     RetainPtr<NSData> strongData = initData;
-    callOnMainThread([strongSelf, strongData, trackID] {
-        if (strongSelf->_parent)
-            strongSelf->_parent->didProvideContentKeyRequestInitializationDataForTrackID(strongData.get(), trackID);
+    callOnMainThread([strongParent, strongData, trackID] {
+        strongParent->didProvideContentKeyRequestInitializationDataForTrackID(strongData.get(), trackID);
     });
 }
 @end
@@ -379,9 +386,8 @@
 }
 
 SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC* parent)
-    : m_weakFactory(this)
-    , m_parser(adoptNS([[getAVStreamDataParserClass() alloc] init]))
-    , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]))
+    : m_parser(adoptNS([[getAVStreamDataParserClass() alloc] init]))
+    , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:this]))
     , m_mediaSource(parent)
     , m_client(0)
     , m_parsingSucceeded(true)
@@ -392,7 +398,6 @@
 
 SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC()
 {
-    ASSERT(!m_client);
     destroyParser();
     destroyRenderers();
 }
@@ -464,8 +469,7 @@
         if (formatSize != m_cachedSize) {
             LOG(Media, "SourceBufferPrivateAVFObjC::processCodedFrame(%p) - size change detected: {width=%lf, height=%lf", formatSize.width(), formatSize.height());
             m_cachedSize = formatSize;
-            if (m_mediaSource)
-                m_mediaSource->player()->sizeChanged();
+            m_mediaSource->player()->sizeChanged();
         }
     }
     if (m_client)
@@ -483,9 +487,6 @@
 
 void SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID(NSData* initData, int trackID)
 {
-    if (!m_mediaSource)
-        return;
-
     UNUSED_PARAM(trackID);
 #if ENABLE(ENCRYPTED_MEDIA_V2)
     LOG(Media, "SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID(%p) - track:%d", this, trackID);
@@ -518,19 +519,15 @@
     LOG(Media, "SourceBufferPrivateAVFObjC::append(%p) - data:%p, length:%d", this, data, length);
 
     RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytes:data length:length]);
-    WeakPtr<SourceBufferPrivateAVFObjC> weakThis = createWeakPtr();
-    RetainPtr<AVStreamDataParser> parser = m_parser;
-    RetainPtr<WebAVStreamDataParserListener> delegate = m_delegate;
+    RefPtr<SourceBufferPrivateAVFObjC> strongThis = this;
 
     m_parsingSucceeded = true;
 
-    dispatch_async(globalDataParserQueue(), [nsData, weakThis, parser, delegate] {
+    dispatch_async(globalDataParserQueue(), [nsData, strongThis] {
+        [strongThis->m_parser appendStreamData:nsData.get()];
 
-        [parser appendStreamData:nsData.get()];
-
-        callOnMainThread([weakThis] {
-            if (weakThis)
-                weakThis->appendCompleted();
+        callOnMainThread([strongThis] {
+            strongThis->appendCompleted();
         });
     });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to