Title: [244716] trunk/Source/WebCore
Revision
244716
Author
jer.no...@apple.com
Date
2019-04-26 22:38:40 -0700 (Fri, 26 Apr 2019)

Log Message

Reduce the number of copies made during SourceBufferPrivateAVFObjC::append() using SharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=197335
<rdar://problem/49175604>

Rubber-stamped by Alex Christensen.

* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::append):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244715 => 244716)


--- trunk/Source/WebCore/ChangeLog	2019-04-27 04:28:55 UTC (rev 244715)
+++ trunk/Source/WebCore/ChangeLog	2019-04-27 05:38:40 UTC (rev 244716)
@@ -1,3 +1,14 @@
+2019-04-26  Jer Noble  <jer.no...@apple.com>
+
+        Reduce the number of copies made during SourceBufferPrivateAVFObjC::append() using SharedBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=197335
+        <rdar://problem/49175604>
+
+        Rubber-stamped by Alex Christensen.
+
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::SourceBufferPrivateAVFObjC::append):
+
 2019-04-26  Jessie Berlin  <jber...@webkit.org>
 
         Add new mac target numbers

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2019-04-27 04:28:55 UTC (rev 244715)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2019-04-27 05:38:40 UTC (rev 244716)
@@ -706,16 +706,12 @@
 {
     DEBUG_LOG(LOGIDENTIFIER, "data length = ", data.size());
 
-    // FIXME: Avoid the data copy by wrapping around the Vector<> object.
-    RetainPtr<NSData> nsData = adoptNS([[NSData alloc] initWithBytes:data.data() length:data.size()]);
-    WeakPtr<SourceBufferPrivateAVFObjC> weakThis = m_appendWeakFactory.createWeakPtr(*this);
-    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, isAppendingGroup = m_isAppendingGroup, parserStateWasReset = m_parserStateWasReset] {
+    dispatch_async(globalDataParserQueue(), [data = "" weakThis = m_appendWeakFactory.createWeakPtr(*this), parser = m_parser, delegate = m_delegate, isAppendingGroup = m_isAppendingGroup, parserStateWasReset = m_parserStateWasReset] () mutable {
+        auto sharedData = SharedBuffer::create(WTFMove(data));
+        auto nsData = sharedData->createNSData();
         if (parserStateWasReset)
             [parser appendStreamData:nsData.get() withFlags:AVStreamDataParserStreamDataDiscontinuity];
         else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to