Title: [206567] branches/safari-602.2.14.0-branch

Diff

Modified: branches/safari-602.2.14.0-branch/LayoutTests/ChangeLog (206566 => 206567)


--- branches/safari-602.2.14.0-branch/LayoutTests/ChangeLog	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/LayoutTests/ChangeLog	2016-09-29 00:54:32 UTC (rev 206567)
@@ -1,3 +1,17 @@
+2016-09-28  Babak Shafiei  <[email protected]>
+
+        Merge r206518. rdar://problem/28505032
+
+    2016-09-28  Jer Noble  <[email protected]>
+
+            [MSE][Mac] In SourceBufferPrivateAVFObjC::abort(), support reseting parser to the last appended initialization segment.
+            https://bugs.webkit.org/show_bug.cgi?id=135164
+
+            Reviewed by Eric Carlson.
+
+            * media/media-source/media-source-abort-resets-parser-expected.txt: Added.
+            * media/media-source/media-source-abort-resets-parser.html: Added.
+
 2016-09-23  Babak Shafiei  <[email protected]>
 
         Merge r203982. rdar://problem/27547583

Added: branches/safari-602.2.14.0-branch/LayoutTests/media/media-source/media-source-abort-resets-parser-expected.txt (0 => 206567)


--- branches/safari-602.2.14.0-branch/LayoutTests/media/media-source/media-source-abort-resets-parser-expected.txt	                        (rev 0)
+++ branches/safari-602.2.14.0-branch/LayoutTests/media/media-source/media-source-abort-resets-parser-expected.txt	2016-09-29 00:54:32 UTC (rev 206567)
@@ -0,0 +1,24 @@
+This tests the ability of the SourceBuffer to reset the parser after an abort(). A SourceBuffer in this state should be able to accept a new initialization segment or a new media segment.
+
+RUN(video.src = ""
+EVENT(sourceopen)
+RUN(source.duration = loader.duration())
+RUN(sourceBuffer = source.addSourceBuffer(loader.type()))
+RUN(sourceBuffer.appendBuffer(loader.initSegment()))
+EVENT(update)
+Append a partial media segment.
+RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0).slice(0, loader.mediaSegment(0).byteLength / 2)))
+EVENT(update)
+Abort and append a new initialization segment.
+RUN(sourceBuffer.abort())
+RUN(sourceBuffer.appendBuffer(loader.initSegment()))
+EVENT(update)
+Append a partial media segment.
+RUN(sourceBuffer.appendBuffer(loader.mediaSegment(0).slice(0, loader.mediaSegment(0).byteLength / 2)))
+EVENT(update)
+Abort and append a new media segment.
+RUN(sourceBuffer.abort())
+RUN(sourceBuffer.appendBuffer(loader.mediaSegment(1)))
+EVENT(update)
+END OF TEST
+

Added: branches/safari-602.2.14.0-branch/LayoutTests/media/media-source/media-source-abort-resets-parser.html (0 => 206567)


--- branches/safari-602.2.14.0-branch/LayoutTests/media/media-source/media-source-abort-resets-parser.html	                        (rev 0)
+++ branches/safari-602.2.14.0-branch/LayoutTests/media/media-source/media-source-abort-resets-parser.html	2016-09-29 00:54:32 UTC (rev 206567)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>media-source-abort-resets-parser</title>
+    <script src=""
+    <script src=""
+    <script>
+    var loader;
+    var source;
+    var sourceBuffer;
+
+    function runTest() {
+        findMediaElement();
+
+        loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
+        loader._onload_ = mediaDataLoaded;
+        loader._onerror_ = mediaDataLoadingFailed;
+    }
+
+    function mediaDataLoadingFailed() {
+        failTest('Media data loading failed');
+    }
+
+    function mediaDataLoaded() {
+        source = new MediaSource();
+        waitForEvent('sourceopen', sourceOpen, false, false, source);
+        waitForEventAndFail('error');
+        run('video.src = ""
+    }
+
+    function sourceOpen() {
+        run('source.duration = loader.duration()');
+        run('sourceBuffer = source.addSourceBuffer(loader.type())');
+        waitForEventOn(sourceBuffer, 'update', sourceInitialized, false, true);
+        run('sourceBuffer.appendBuffer(loader.initSegment())');
+    }
+
+    function sourceInitialized() {
+        waitForEventOn(sourceBuffer, 'update', partialMediaSegmentAppended1, false, true);
+        consoleWrite('Append a partial media segment.')
+        run('sourceBuffer.appendBuffer(loader.mediaSegment(0).slice(0, loader.mediaSegment(0).byteLength / 2))');
+    }
+
+    function partialMediaSegmentAppended1() {
+        consoleWrite('Abort and append a new initialization segment.')
+        run('sourceBuffer.abort()');
+        run('sourceBuffer.appendBuffer(loader.initSegment())');
+        waitForEventOn(sourceBuffer, 'update', initSegmentAppended, false, true);
+    }
+
+    function initSegmentAppended() {
+        waitForEventOn(sourceBuffer, 'update', partialMediaSegmentAppended2, false, true);
+        consoleWrite('Append a partial media segment.')
+        run('sourceBuffer.appendBuffer(loader.mediaSegment(0).slice(0, loader.mediaSegment(0).byteLength / 2))');
+    }
+
+    function partialMediaSegmentAppended2() {
+        consoleWrite('Abort and append a new media segment.')
+        run('sourceBuffer.abort()');
+        run('sourceBuffer.appendBuffer(loader.mediaSegment(1))');
+        waitForEventOn(sourceBuffer, 'update', endTest, false, true);
+    }
+    </script>
+</head>
+<body _onload_="runTest()">
+    <div>
+        This tests the ability of the SourceBuffer to reset the parser after an abort(). A SourceBuffer in this state should be able to accept
+        a new initialization segment or a new media segment.
+    </div>
+    <video controls></video>
+</body>
+</html>
\ No newline at end of file

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/ChangeLog (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/ChangeLog	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/ChangeLog	2016-09-29 00:54:32 UTC (rev 206567)
@@ -1,3 +1,59 @@
+2016-09-28  Babak Shafiei  <[email protected]>
+
+        Merge r206518. rdar://problem/28505032
+
+    2016-09-28  Jer Noble  <[email protected]>
+
+            [MSE][Mac] In SourceBufferPrivateAVFObjC::abort(), support reseting parser to the last appended initialization segment.
+            https://bugs.webkit.org/show_bug.cgi?id=135164
+
+            Reviewed by Eric Carlson.
+
+            Test: media/media-source/media-source-abort-resets-parser.html
+
+            Use the -[AVStreamDataParser appendStreamData:withFlags:] to implement "resetting" the parser. In this case,
+            the parser isn't explicitly reset during resetParserState(), but rather a flag is set so that the next append
+            signals a data discontinuity, and the parser is reset at that point.
+
+            Because a previous append operation may be in-flight during this abort(), care must be taken to invalidate any
+            operations which may have already started on a background thread. So SourceBufferPrivateAVFObjC will use a
+            separate WeakPtrFactory for its append operations, will invalidate any outstanding WeakPtrs during an abort(),
+            and will block until the previous append() operation completes.
+
+            This will require the WebAVStreamDataParserListener object to occasionally have it's WeakPtr pointing back to the
+            SourceBufferPrivateAVFObjC to be reset after an abort(), so make that ivar an @property. Rather than passing a
+            RetainPtr to itself in all the callbacks it handles, the WebAVStreamDataParserListener can just pass in a copy
+            of its own WeakPtr (which may be invalidated during an abort()).
+
+            Break the distinct operations of "abort()" and "resetParserState()" into their own methods in SourceBufferPrivate
+            and all its subclasses.
+
+            * Modules/mediasource/SourceBuffer.cpp:
+            (WebCore::SourceBuffer::resetParserState):
+            (WebCore::SourceBuffer::abortIfUpdating):
+            * platform/graphics/SourceBufferPrivate.h:
+            * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
+            * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+            (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
+            (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
+            (-[WebAVStreamDataParserListener streamDataParser:didFailToParseStreamDataWithError:]):
+            (-[WebAVStreamDataParserListener streamDataParser:didProvideMediaData:forTrackID:mediaType:flags:]):
+            (-[WebAVStreamDataParserListener streamDataParser:didReachEndOfTrackWithTrackID:mediaType:]):
+            (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
+            (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
+            (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
+            (WebCore::SourceBufferPrivateAVFObjC::append):
+            (WebCore::SourceBufferPrivateAVFObjC::abort):
+            (WebCore::SourceBufferPrivateAVFObjC::resetParserState):
+            (-[WebAVStreamDataParserListener initWithParser:parent:]): Deleted.
+            * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp:
+            (WebCore::SourceBufferPrivateGStreamer::resetParserState):
+            * platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h:
+            * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
+            (WebCore::MockSourceBufferPrivate::resetParserState):
+            * platform/mock/mediasource/MockSourceBufferPrivate.h:
+            * platform/spi/mac/AVFoundationSPI.h:
+
 2016-09-27  Babak Shafiei  <[email protected]>
 
         Merge r206454. rdar://problem/28484193

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2016-09-29 00:54:32 UTC (rev 206567)
@@ -282,7 +282,7 @@
     // 7. Set append state to WAITING_FOR_SEGMENT.
     m_appendState = WaitingForSegment;
 
-    m_private->abort();
+    m_private->resetParserState();
 }
 
 void SourceBuffer::abort(ExceptionCode& ec)
@@ -380,6 +380,7 @@
     // 3.1. Abort the buffer append and stream append loop algorithms if they are running.
     m_appendBufferTimer.stop();
     m_pendingAppendData.clear();
+    m_private->abort();
 
     m_removeTimer.stop();
     m_pendingRemoveStart = MediaTime::invalidTime();

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/SourceBufferPrivate.h (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/SourceBufferPrivate.h	2016-09-29 00:54:32 UTC (rev 206567)
@@ -52,6 +52,7 @@
 
     virtual void append(const unsigned char* data, unsigned length) = 0;
     virtual void abort() = 0;
+    virtual void resetParserState() = 0;
     virtual void removedFromMediaSource() = 0;
 
     virtual MediaPlayer::ReadyState readyState() const = 0;

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h	2016-09-29 00:54:32 UTC (rev 206567)
@@ -29,6 +29,7 @@
 #if ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION)
 
 #include "SourceBufferPrivate.h"
+#include <dispatch/group.h>
 #include <dispatch/semaphore.h>
 #include <wtf/Deque.h>
 #include <wtf/HashMap.h>
@@ -115,6 +116,7 @@
     void setClient(SourceBufferPrivateClient*) override;
     void append(const unsigned char* data, unsigned length) override;
     void abort() override;
+    void resetParserState() override;
     void removedFromMediaSource() override;
     MediaPlayer::ReadyState readyState() const override;
     void setReadyState(MediaPlayer::ReadyState) override;
@@ -139,6 +141,7 @@
     Vector<SourceBufferPrivateAVFObjCErrorClient*> m_errorClients;
 
     WeakPtrFactory<SourceBufferPrivateAVFObjC> m_weakFactory;
+    WeakPtrFactory<SourceBufferPrivateAVFObjC> m_appendWeakFactory;
 
     RetainPtr<AVStreamDataParser> m_parser;
     RetainPtr<AVAsset> m_asset;
@@ -148,6 +151,7 @@
     RetainPtr<WebAVSampleBufferErrorListener> m_errorListener;
     RetainPtr<NSError> m_hdcpError;
     OSObjectPtr<dispatch_semaphore_t> m_hasSessionSemaphore;
+    OSObjectPtr<dispatch_group_t> m_isAppendingGroup;
 
     MediaSourcePrivateAVFObjC* m_mediaSource;
     SourceBufferPrivateClient* m_client;
@@ -155,6 +159,7 @@
 
     FloatSize m_cachedSize;
     bool m_parsingSucceeded;
+    bool m_parserStateWasReset { false };
     int m_enabledVideoTrackID;
     int m_protectedTrackID;
 };

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2016-09-29 00:54:32 UTC (rev 206567)
@@ -130,6 +130,7 @@
     WeakPtr<WebCore::SourceBufferPrivateAVFObjC> _parent;
     AVStreamDataParser* _parser;
 }
+@property (assign) WeakPtr<WebCore::SourceBufferPrivateAVFObjC> parent;
 - (id)initWithParser:(AVStreamDataParser*)parser parent:(WeakPtr<WebCore::SourceBufferPrivateAVFObjC>)parent;
 @end
 
@@ -147,6 +148,8 @@
     return self;
 }
 
+@synthesize parent=_parent;
+
 - (void)dealloc
 {
     [_parser setDelegate:nil];
@@ -165,12 +168,11 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> protectedSelf = self;
 
     RetainPtr<AVAsset*> protectedAsset = asset;
-    callOnMainThread([protectedSelf = WTFMove(protectedSelf), protectedAsset = WTFMove(protectedAsset)] {
-        if (protectedSelf->_parent)
-            protectedSelf->_parent->didParseStreamDataAsAsset(protectedAsset.get());
+    callOnMainThread([parent = _parent, protectedAsset = WTFMove(protectedAsset)] {
+        if (parent)
+            parent->didParseStreamDataAsAsset(protectedAsset.get());
     });
 }
 
@@ -181,12 +183,11 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> protectedSelf = self;
 
     RetainPtr<AVAsset*> protectedAsset = asset;
-    callOnMainThread([protectedSelf = WTFMove(protectedSelf), protectedAsset = WTFMove(protectedAsset)] {
-        if (protectedSelf->_parent)
-            protectedSelf->_parent->didParseStreamDataAsAsset(protectedAsset.get());
+    callOnMainThread([parent = _parent, protectedAsset = WTFMove(protectedAsset)] {
+        if (parent)
+            parent->didParseStreamDataAsAsset(protectedAsset.get());
     });
 }
 
@@ -196,12 +197,11 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> protectedSelf = self;
 
     RetainPtr<NSError> protectedError = error;
-    callOnMainThread([protectedSelf = WTFMove(protectedSelf), protectedError = WTFMove(protectedError)] {
-        if (protectedSelf->_parent)
-            protectedSelf->_parent->didFailToParseStreamDataWithError(protectedError.get());
+    callOnMainThread([parent = _parent, protectedError = WTFMove(protectedError)] {
+        if (parent)
+            parent->didFailToParseStreamDataWithError(protectedError.get());
     });
 }
 
@@ -211,13 +211,12 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> protectedSelf = self;
 
     RetainPtr<CMSampleBufferRef> protectedSample = sample;
     String mediaType = nsMediaType;
-    callOnMainThread([protectedSelf = WTFMove(protectedSelf), protectedSample = WTFMove(protectedSample), trackID, mediaType, flags] {
-        if (protectedSelf->_parent)
-            protectedSelf->_parent->didProvideMediaDataForTrackID(trackID, protectedSample.get(), mediaType, flags);
+    callOnMainThread([parent = _parent, protectedSample = WTFMove(protectedSample), trackID, mediaType, flags] {
+        if (parent)
+            parent->didProvideMediaDataForTrackID(trackID, protectedSample.get(), mediaType, flags);
     });
 }
 
@@ -227,12 +226,11 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> protectedSelf = self;
 
     String mediaType = nsMediaType;
-    callOnMainThread([protectedSelf = WTFMove(protectedSelf), trackID, mediaType] {
-        if (protectedSelf->_parent)
-            protectedSelf->_parent->didReachEndOfTrackWithTrackID(trackID, mediaType);
+    callOnMainThread([parent = _parent, trackID, mediaType] {
+        if (parent)
+            parent->didReachEndOfTrackWithTrackID(trackID, mediaType);
     });
 }
 
@@ -245,10 +243,9 @@
 
     // We must call synchronously to the main thread, as the AVStreamSession must be associated
     // with the streamDataParser before the delegate method returns.
-    RetainPtr<WebAVStreamDataParserListener> strongSelf = self;
-    dispatch_sync(dispatch_get_main_queue(), [strongSelf, trackID]() {
-        if (strongSelf->_parent)
-            strongSelf->_parent->willProvideContentKeyRequestInitializationDataForTrackID(trackID);
+    dispatch_sync(dispatch_get_main_queue(), [parent = _parent, trackID]() {
+        if (parent)
+            parent->willProvideContentKeyRequestInitializationDataForTrackID(trackID);
     });
 }
 
@@ -258,12 +255,11 @@
     UNUSED_PARAM(streamDataParser);
 #endif
     ASSERT(streamDataParser == _parser);
-    RetainPtr<WebAVStreamDataParserListener> protectedSelf = self;
 
     OSObjectPtr<dispatch_semaphore_t> hasSessionSemaphore = adoptOSObject(dispatch_semaphore_create(0));
-    callOnMainThread([protectedSelf = WTFMove(protectedSelf), protectedInitData = RetainPtr<NSData>(initData), trackID, hasSessionSemaphore] {
-        if (protectedSelf->_parent)
-            protectedSelf->_parent->didProvideContentKeyRequestInitializationDataForTrackID(protectedInitData.get(), trackID, hasSessionSemaphore);
+    callOnMainThread([parent = _parent, protectedInitData = RetainPtr<NSData>(initData), trackID, hasSessionSemaphore] {
+        if (parent)
+            parent->didProvideContentKeyRequestInitializationDataForTrackID(protectedInitData.get(), trackID, hasSessionSemaphore);
     });
     dispatch_semaphore_wait(hasSessionSemaphore.get(), DISPATCH_TIME_FOREVER);
 }
@@ -582,9 +578,11 @@
 
 SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC* parent)
     : m_weakFactory(this)
+    , m_appendWeakFactory(this)
     , m_parser(adoptNS([allocAVStreamDataParserInstance() init]))
     , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]))
     , m_errorListener(adoptNS([[WebAVSampleBufferErrorListener alloc] initWithParent:this]))
+    , m_isAppendingGroup(adoptOSObject(dispatch_group_create()))
     , m_mediaSource(parent)
     , m_client(0)
     , m_parsingSucceeded(true)
@@ -772,21 +770,26 @@
     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();
+    WeakPtr<SourceBufferPrivateAVFObjC> weakThis = m_appendWeakFactory.createWeakPtr();
     RetainPtr<AVStreamDataParser> parser = m_parser;
     RetainPtr<WebAVStreamDataParserListener> delegate = m_delegate;
 
     m_parsingSucceeded = true;
+    dispatch_group_enter(m_isAppendingGroup.get());
 
-    dispatch_async(globalDataParserQueue(), [nsData, weakThis, parser, delegate] {
+    dispatch_async(globalDataParserQueue(), [nsData, weakThis, parser, delegate, isAppendingGroup = m_isAppendingGroup, parserStateWasReset = m_parserStateWasReset] {
+        if (parserStateWasReset)
+            [parser appendStreamData:nsData.get() withFlags:AVStreamDataParserStreamDataDiscontinuity];
+        else
+            [parser appendStreamData:nsData.get()];
 
-        [parser appendStreamData:nsData.get()];
-
         callOnMainThread([weakThis] {
             if (weakThis)
                 weakThis->appendCompleted();
         });
+        dispatch_group_leave(isAppendingGroup.get());
     });
+    m_parserStateWasReset = false;
 }
 
 void SourceBufferPrivateAVFObjC::appendCompleted()
@@ -800,12 +803,19 @@
 
 void SourceBufferPrivateAVFObjC::abort()
 {
-    // The parser does not have a mechanism for resetting to a clean state, so destroy and re-create it.
-    // FIXME(135164): Support resetting parser to the last appended initialization segment.
-    destroyParser();
+    // The parsing queue may be blocked waiting for the main thread to provide it a AVStreamSession. We
+    // were asked to abort, and that cancels all outstanding append operations. Without cancelling this
+    // semaphore, the m_isAppendingGroup wait operation will deadlock.
+    if (m_hasSessionSemaphore)
+        dispatch_semaphore_signal(m_hasSessionSemaphore.get());
+    dispatch_group_wait(m_isAppendingGroup.get(), DISPATCH_TIME_FOREVER);
+    m_appendWeakFactory.revokeAll();
+    m_delegate.get().parent = m_appendWeakFactory.createWeakPtr();
+}
 
-    m_parser = adoptNS([allocAVStreamDataParserInstance() init]);
-    m_delegate = adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]);
+void SourceBufferPrivateAVFObjC::resetParserState()
+{
+    m_parserStateWasReset = true;
 }
 
 void SourceBufferPrivateAVFObjC::destroyParser()

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.cpp	2016-09-29 00:54:32 UTC (rev 206567)
@@ -75,6 +75,11 @@
     notImplemented();
 }
 
+void SourceBufferPrivateGStreamer::resetParserState()
+{
+    notImplemented();
+}
+
 void SourceBufferPrivateGStreamer::removedFromMediaSource()
 {
     m_client->removedFromMediaSource(this);

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/graphics/gstreamer/SourceBufferPrivateGStreamer.h	2016-09-29 00:54:32 UTC (rev 206567)
@@ -50,6 +50,7 @@
 
     virtual void append(const unsigned char* data, unsigned length);
     virtual void abort();
+    virtual void resetParserState();
     virtual void removedFromMediaSource();
 
     virtual MediaPlayer::ReadyState readyState() const;

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp	2016-09-29 00:54:32 UTC (rev 206567)
@@ -198,6 +198,10 @@
 {
 }
 
+void MockSourceBufferPrivate::resetParserState()
+{
+}
+
 void MockSourceBufferPrivate::removedFromMediaSource()
 {
     if (m_mediaSource)

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h	2016-09-29 00:54:32 UTC (rev 206567)
@@ -65,6 +65,7 @@
     void setClient(SourceBufferPrivateClient*) override;
     void append(const unsigned char* data, unsigned length) override;
     void abort() override;
+    void resetParserState() override;
     void removedFromMediaSource() override;
     MediaPlayer::ReadyState readyState() const override;
     void setReadyState(MediaPlayer::ReadyState) override;

Modified: branches/safari-602.2.14.0-branch/Source/WebCore/platform/spi/mac/AVFoundationSPI.h (206566 => 206567)


--- branches/safari-602.2.14.0-branch/Source/WebCore/platform/spi/mac/AVFoundationSPI.h	2016-09-29 00:54:27 UTC (rev 206566)
+++ branches/safari-602.2.14.0-branch/Source/WebCore/platform/spi/mac/AVFoundationSPI.h	2016-09-29 00:54:32 UTC (rev 206567)
@@ -116,9 +116,14 @@
     AVStreamDataParserOutputMediaDataReserved = 1 << 0
 };
 
+typedef NS_ENUM(NSUInteger, AVStreamDataParserStreamDataFlags) {
+    AVStreamDataParserStreamDataDiscontinuity = 1 << 0,
+};
+
 @interface AVStreamDataParser : NSObject
 - (void)setDelegate:(nullable id<AVStreamDataParserOutputHandling>)delegate;
 - (void)appendStreamData:(NSData *)data;
+- (void)appendStreamData:(NSData *)data withFlags:(AVStreamDataParserStreamDataFlags)flags;
 - (void)setShouldProvideMediaData:(BOOL)shouldProvideMediaData forTrackID:(CMPersistentTrackID)trackID;
 - (BOOL)shouldProvideMediaDataForTrackID:(CMPersistentTrackID)trackID;
 - (void)providePendingMediaData;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to