Title: [277016] trunk/Source/WebCore
Revision
277016
Author
commit-qu...@webkit.org
Date
2021-05-05 06:55:12 -0700 (Wed, 05 May 2021)

Log Message

[GStreamer][WebRTC] Wrap incoming audio buffers, complying with fastMalloc restrictions
https://bugs.webkit.org/show_bug.cgi?id=225351

Patch by Philippe Normand <pnorm...@igalia.com> on 2021-05-05
Reviewed by Xabier Rodriguez-Calvar.

The audio thread should avoid calling fastMalloc for performance reasons, so audio buffers
are now wrapped in GStreamer buffers and passed as read-only memories to the observers.

* platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeIncomingAudioSourceLibWebRTC::OnData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (277015 => 277016)


--- trunk/Source/WebCore/ChangeLog	2021-05-05 13:39:11 UTC (rev 277015)
+++ trunk/Source/WebCore/ChangeLog	2021-05-05 13:55:12 UTC (rev 277016)
@@ -1,3 +1,16 @@
+2021-05-05  Philippe Normand  <pnorm...@igalia.com>
+
+        [GStreamer][WebRTC] Wrap incoming audio buffers, complying with fastMalloc restrictions
+        https://bugs.webkit.org/show_bug.cgi?id=225351
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The audio thread should avoid calling fastMalloc for performance reasons, so audio buffers
+        are now wrapped in GStreamer buffers and passed as read-only memories to the observers.
+
+        * platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp:
+        (WebCore::RealtimeIncomingAudioSourceLibWebRTC::OnData):
+
 2021-05-05  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [SOUP] Wrong cookie timestamp in case of long expire time

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp (277015 => 277016)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp	2021-05-05 13:39:11 UTC (rev 277015)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeIncomingAudioSourceLibWebRTC.cpp	2021-05-05 13:55:12 UTC (rev 277016)
@@ -64,17 +64,8 @@
 
     gst_audio_info_set_format(&info, format, sampleRate, numberOfChannels, NULL);
 
-    // FIXME: We could likely avoid allocation here, when muted -> memset(0...) and maybe wrap the
-    // audioData in a GstBuffer?
-    DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
     auto bufferSize = GST_AUDIO_INFO_BPF(&info) * numberOfFrames;
-    gpointer bufferData = fastMalloc(bufferSize);
-    if (muted())
-        webkitGstAudioFormatFillSilence(info.finfo, bufferData, bufferSize);
-    else
-        memcpy(bufferData, audioData, bufferSize);
-
-    auto buffer = adoptGRef(gstBufferNewWrappedFast(bufferData, bufferSize));
+    auto buffer = adoptGRef(gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, const_cast<gpointer>(audioData), bufferSize, 0, bufferSize, nullptr, nullptr));
     auto caps = adoptGRef(gst_audio_info_to_caps(&info));
     auto sample = adoptGRef(gst_sample_new(buffer.get(), caps.get(), nullptr, nullptr));
     GStreamerAudioData data(WTFMove(sample), info);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to