MediaSourceClientGStreamerMSE: wrap FastMalloc-ed memory into pipeline-bound GstBuffers
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Feb 2017 17:59:16 +0000 (17:59 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Feb 2017 17:59:16 +0000 (17:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167928

Reviewed by Xabier Rodriguez-Calvar.

The buffers created in MediaSourceClientGStreamerMSE can be large enough in size
that repetitive allocations can cause larger heap fragmentation in different libc
allocators. To avoid that occurrence, we should simply use FastMalloc to allocate
memory for these buffers.

* platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
(WebCore::MediaSourceClientGStreamerMSE::append):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211814 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp

index 24d9ce1..5160262 100644 (file)
@@ -1,3 +1,18 @@
+2017-02-07  Zan Dobersek  <zdobersek@igalia.com>
+
+        MediaSourceClientGStreamerMSE: wrap FastMalloc-ed memory into pipeline-bound GstBuffers
+        https://bugs.webkit.org/show_bug.cgi?id=167928
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The buffers created in MediaSourceClientGStreamerMSE can be large enough in size
+        that repetitive allocations can cause larger heap fragmentation in different libc
+        allocators. To avoid that occurrence, we should simply use FastMalloc to allocate
+        memory for these buffers.
+
+        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
+        (WebCore::MediaSourceClientGStreamerMSE::append):
+
 2017-02-07  Antoine Quint  <graouts@apple.com>
 
         [Modern Media Controls] Handle media durations of an hour or more gracefully
index ac8e787..0a80d56 100644 (file)
@@ -133,7 +133,8 @@ bool MediaSourceClientGStreamerMSE::append(RefPtr<SourceBufferPrivateGStreamer>
 
     ASSERT(appendPipeline);
 
-    GstBuffer* buffer = gst_buffer_new_and_alloc(length);
+    void* bufferData = fastMalloc(length);
+    GstBuffer* buffer = gst_buffer_new_wrapped_full(static_cast<GstMemoryFlags>(0), bufferData, length, 0, length, bufferData, fastFree);
     gst_buffer_fill(buffer, 0, data, length);
 
     return appendPipeline->pushNewBuffer(buffer) == GST_FLOW_OK;