Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (276748 => 276749)
--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog 2021-04-29 03:55:51 UTC (rev 276748)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog 2021-04-29 07:15:18 UTC (rev 276749)
@@ -1,3 +1,17 @@
+2021-04-06 Philippe Normand <[email protected]>
+
+ [GStreamer][MediaStream] AudioSource triggering critical warnings
+ https://bugs.webkit.org/show_bug.cgi?id=224180
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Keep track of audio channel offsets and store them as metadata in audio buffers. This is
+ used by downstream elements such as the audio convert elements.
+
+ * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp:
+ (WebCore::copyBusData):
+ (WebCore::MediaStreamAudioSource::consumeAudio):
+
2021-04-13 Philippe Normand <[email protected]>
[GStreamer] CaptureDevice monitor used from UIProcess
Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp (276748 => 276749)
--- releases/WebKitGTK/webkit-2.32/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp 2021-04-29 03:55:51 UTC (rev 276748)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp 2021-04-29 07:15:18 UTC (rev 276749)
@@ -29,20 +29,25 @@
namespace WebCore {
-static void copyBusData(AudioBus& bus, GstBuffer* buffer, bool isMuted)
+static Vector<size_t> copyBusData(AudioBus& bus, GstBuffer* buffer, bool isMuted)
{
+ Vector<size_t> offsets;
GstMappedBuffer mappedBuffer(buffer, GST_MAP_WRITE);
if (isMuted) {
memset(mappedBuffer.data(), 0, mappedBuffer.size());
- return;
+ return offsets;
}
+ DisableMallocRestrictionsForCurrentThreadScope disableMallocRestrictions;
+ offsets.reserveInitialCapacity(sizeof(size_t) * bus.numberOfChannels());
size_t size = mappedBuffer.size() / bus.numberOfChannels();
for (size_t channelIndex = 0; channelIndex < bus.numberOfChannels(); ++channelIndex) {
- AudioChannel& channel = *bus.channel(channelIndex);
- float* destination = reinterpret_cast<float*>(mappedBuffer.data() + (channelIndex * size));
- memcpy(destination, channel.data(), size);
+ const auto& channel = *bus.channel(channelIndex);
+ auto offset = reinterpret_cast<size_t>(channelIndex * size);
+ memcpy(reinterpret_cast<float*>(mappedBuffer.data() + offset), channel.data(), sizeof(float) * channel.length());
+ offsets.uncheckedAppend(offset);
}
+ return offsets;
}
void MediaStreamAudioSource::consumeAudio(AudioBus& bus, size_t numberOfFrames)
@@ -62,7 +67,12 @@
auto caps = adoptGRef(gst_audio_info_to_caps(&info));
auto buffer = adoptGRef(gst_buffer_new_allocate(nullptr, size, nullptr));
- copyBusData(bus, buffer.get(), muted());
+ auto offsets = copyBusData(bus, buffer.get(), muted());
+#if GST_CHECK_VERSION(1, 16, 0)
+ gst_buffer_add_audio_meta(buffer.get(), &info, numberOfFrames, offsets.data());
+#else
+ UNUSED_VARIABLE(offsets);
+#endif
auto sample = adoptGRef(gst_sample_new(buffer.get(), caps.get(), nullptr, nullptr));
GStreamerAudioData audioBuffer(WTFMove(sample), info);
GStreamerAudioStreamDescription description(&info);