Title: [269827] trunk
Revision
269827
Author
[email protected]
Date
2020-11-15 07:38:57 -0800 (Sun, 15 Nov 2020)

Log Message

[GStreamer] WebAudio to MediaStream support
https://bugs.webkit.org/show_bug.cgi?id=218335

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Provide audio samples coming from the WebAudio bus to the MediaStreamAudioSource node, using
GStreamer. This patch also moves a couple files from platform/mediastream to platform/audio,
because this is where the virtual parent classes are defined.

* Modules/webaudio/MediaStreamAudioSource.cpp:
* Modules/webaudio/MediaStreamAudioSource.h:
* Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp: Added.
(WebCore::copyBusData):
(WebCore::MediaStreamAudioSource::consumeAudio):
* platform/GStreamer.cmake:
* platform/audio/gstreamer/GStreamerAudioData.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioData.h.
(isType):
* platform/audio/gstreamer/GStreamerAudioStreamDescription.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h.
* platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
(WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):

LayoutTests:

* platform/gtk/TestExpectations: webrtc/peer-connection-createMediaStreamDestination.html is now passing.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269826 => 269827)


--- trunk/LayoutTests/ChangeLog	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/LayoutTests/ChangeLog	2020-11-15 15:38:57 UTC (rev 269827)
@@ -1,3 +1,12 @@
+2020-11-15  Philippe Normand  <[email protected]>
+
+        [GStreamer] WebAudio to MediaStream support
+        https://bugs.webkit.org/show_bug.cgi?id=218335
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        * platform/gtk/TestExpectations: webrtc/peer-connection-createMediaStreamDestination.html is now passing.
+
 2020-11-14  Rob Buis  <[email protected]>
 
         Remove -webkit-aspect-ratio support

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (269826 => 269827)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2020-11-15 15:38:57 UTC (rev 269827)
@@ -720,8 +720,6 @@
 webkit.org/b/187064 webrtc/libwebrtc/descriptionGetters.html
 webkit.org/b/177533 webrtc/video-interruption.html
 
-webkit.org/b/186933 webrtc/peer-connection-createMediaStreamDestination.html
-
 imported/w3c/web-platform-tests/webrtc/ [ Skip ]
 http/tests/webrtc [ Skip ]
 

Modified: trunk/Source/WebCore/ChangeLog (269826 => 269827)


--- trunk/Source/WebCore/ChangeLog	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/Source/WebCore/ChangeLog	2020-11-15 15:38:57 UTC (rev 269827)
@@ -1,3 +1,27 @@
+2020-11-15  Philippe Normand  <[email protected]>
+
+        [GStreamer] WebAudio to MediaStream support
+        https://bugs.webkit.org/show_bug.cgi?id=218335
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Provide audio samples coming from the WebAudio bus to the MediaStreamAudioSource node, using
+        GStreamer. This patch also moves a couple files from platform/mediastream to platform/audio,
+        because this is where the virtual parent classes are defined.
+
+        * Modules/webaudio/MediaStreamAudioSource.cpp:
+        * Modules/webaudio/MediaStreamAudioSource.h:
+        * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp: Added.
+        (WebCore::copyBusData):
+        (WebCore::MediaStreamAudioSource::consumeAudio):
+        * platform/GStreamer.cmake:
+        * platform/audio/gstreamer/GStreamerAudioData.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioData.h.
+        (isType):
+        * platform/audio/gstreamer/GStreamerAudioStreamDescription.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h.
+        * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
+        (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
+        (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
+
 2020-11-15  Zalan Bujtas  <[email protected]>
 
         [LFC] Do not use RenderStyle's logical margin API

Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp (269826 => 269827)


--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp	2020-11-15 15:38:57 UTC (rev 269827)
@@ -57,7 +57,7 @@
     return m_currentSettings;
 }
 
-#if !PLATFORM(COCOA)
+#if !PLATFORM(COCOA) && !USE(GSTREAMER)
 void MediaStreamAudioSource::consumeAudio(AudioBus&, size_t)
 {
 }

Modified: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h (269826 => 269827)


--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h	2020-11-15 15:38:57 UTC (rev 269827)
@@ -60,7 +60,7 @@
     String m_deviceId;
     RealtimeMediaSourceSettings m_currentSettings;
     std::unique_ptr<PlatformAudioData> m_audioBuffer;
-#if USE(AVFOUNDATION)
+#if USE(AVFOUNDATION) || USE(GSTREAMER)
     size_t m_numberOfFrames { 0 };
 #endif
 };

Added: trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp (0 => 269827)


--- trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp	2020-11-15 15:38:57 UTC (rev 269827)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * aint with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "MediaStreamAudioSource.h"
+
+#if ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
+
+#include "AudioBus.h"
+#include "GStreamerAudioData.h"
+#include "GStreamerAudioStreamDescription.h"
+#include "Logging.h"
+
+namespace WebCore {
+
+static void copyBusData(AudioBus& bus, GstBuffer* buffer, bool isMuted)
+{
+    GstMappedBuffer mappedBuffer(buffer, GST_MAP_WRITE);
+    if (isMuted) {
+        memset(mappedBuffer.data(), 0, mappedBuffer.size());
+        return;
+    }
+
+    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);
+    }
+}
+
+void MediaStreamAudioSource::consumeAudio(AudioBus& bus, size_t numberOfFrames)
+{
+    if (!bus.numberOfChannels() || bus.numberOfChannels() > 2) {
+        RELEASE_LOG_ERROR(Media, "MediaStreamAudioSource::consumeAudio(%p) trying to consume bus with %u channels", this, bus.numberOfChannels());
+        return;
+    }
+
+    auto mediaTime = MediaTime((m_numberOfFrames * G_USEC_PER_SEC) / m_currentSettings.sampleRate(), G_USEC_PER_SEC);
+    m_numberOfFrames += numberOfFrames;
+
+    GstAudioInfo info;
+    gst_audio_info_set_format(&info, GST_AUDIO_FORMAT_F32LE, m_currentSettings.sampleRate(), bus.numberOfChannels(), nullptr);
+    GST_AUDIO_INFO_LAYOUT(&info) = GST_AUDIO_LAYOUT_NON_INTERLEAVED;
+    size_t size = GST_AUDIO_INFO_BPF(&info) * bus.numberOfChannels() * numberOfFrames;
+
+    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 sample = adoptGRef(gst_sample_new(buffer.get(), caps.get(), nullptr, nullptr));
+    m_audioBuffer = makeUnique<GStreamerAudioData>(WTFMove(sample), info);
+
+    GStreamerAudioStreamDescription description(info);
+    audioSamplesAvailable(mediaTime, *m_audioBuffer, description, numberOfFrames);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/GStreamer.cmake (269826 => 269827)


--- trunk/Source/WebCore/platform/GStreamer.cmake	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/Source/WebCore/platform/GStreamer.cmake	2020-11-15 15:38:57 UTC (rev 269827)
@@ -6,6 +6,7 @@
     )
 
     list(APPEND WebCore_SOURCES
+        Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp
         platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp
         platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp
         platform/graphics/gstreamer/GRefPtrGStreamer.cpp

Copied: trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioData.h (from rev 269826, trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioData.h) (0 => 269827)


--- trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioData.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioData.h	2020-11-15 15:38:57 UTC (rev 269827)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 Metrological Group B.V.
+ * Author: Thibault Saunier <[email protected]>
+ * Author: Alejandro G. Castro <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * aint with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#if USE(GSTREAMER)
+
+#include "GRefPtrGStreamer.h"
+#include "PlatformAudioData.h"
+
+#include <gst/audio/audio.h>
+
+namespace WebCore {
+
+class GStreamerAudioData final : public PlatformAudioData {
+public:
+    GStreamerAudioData(GRefPtr<GstSample>&& sample, GstAudioInfo info)
+        : m_sample(WTFMove(sample))
+        , m_audioInfo(info)
+    {
+    }
+
+    GStreamerAudioData(GRefPtr<GstSample>&& sample)
+        : m_sample(WTFMove(sample))
+    {
+        gst_audio_info_from_caps(&m_audioInfo, gst_sample_get_caps(m_sample.get()));
+    }
+
+    void setSample(GRefPtr<GstSample>&& sample) { m_sample = WTFMove(sample); }
+    GstSample* getSample() { return m_sample.get(); }
+    GstAudioInfo getAudioInfo() { return m_audioInfo; }
+    uint32_t channelCount() const { return GST_AUDIO_INFO_CHANNELS(&m_audioInfo); }
+
+private:
+    Kind kind() const { return Kind::GStreamerAudioData; }
+    GRefPtr<GstSample> m_sample;
+    GstAudioInfo m_audioInfo;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::GStreamerAudioData)
+static bool isType(const WebCore::PlatformAudioData& data) { return data.kind() == WebCore::PlatformAudioData::Kind::GStreamerAudioData; }
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // USE(GSTREAMER)

Copied: trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioStreamDescription.h (from rev 269826, trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h) (0 => 269827)


--- trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioStreamDescription.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioStreamDescription.h	2020-11-15 15:38:57 UTC (rev 269827)
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2018 Metrological Group B.V.
+ * Copyright (C) 2018, 2020 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * aint with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#if USE(GSTREAMER)
+
+#include "AudioStreamDescription.h"
+#include "GStreamerCommon.h"
+#include <gst/audio/audio.h>
+
+namespace WebCore {
+
+class GStreamerAudioStreamDescription final: public AudioStreamDescription {
+public:
+    GStreamerAudioStreamDescription(GstAudioInfo info)
+        : m_info(info)
+        , m_caps(adoptGRef(gst_audio_info_to_caps(&m_info)))
+    {
+    }
+
+    GStreamerAudioStreamDescription(GstAudioInfo *info)
+        : m_info(*info)
+        , m_caps(adoptGRef(gst_audio_info_to_caps(&m_info)))
+    {
+    }
+
+    GStreamerAudioStreamDescription()
+    {
+        gst_audio_info_init(&m_info);
+    }
+
+    ~GStreamerAudioStreamDescription() = default;
+
+    const PlatformDescription& platformDescription() const
+    {
+        m_platformDescription = { PlatformDescription::GStreamerAudioStreamDescription, reinterpret_cast<const AudioStreamBasicDescription*>(&m_info) };
+
+        return m_platformDescription;
+    }
+
+    PCMFormat format() const final
+    {
+        switch (GST_AUDIO_INFO_FORMAT(&m_info)) {
+        case GST_AUDIO_FORMAT_S16LE:
+        case GST_AUDIO_FORMAT_S16BE:
+            return Int16;
+        case GST_AUDIO_FORMAT_S32LE:
+        case GST_AUDIO_FORMAT_S32BE:
+            return Int32;
+        case GST_AUDIO_FORMAT_F32LE:
+        case GST_AUDIO_FORMAT_F32BE:
+            return Float32;
+        case GST_AUDIO_FORMAT_F64LE:
+        case GST_AUDIO_FORMAT_F64BE:
+            return Float64;
+        default:
+            break;
+        }
+        return None;
+    }
+
+    double sampleRate() const final { return GST_AUDIO_INFO_RATE(&m_info); }
+    bool isPCM() const final { return format() != None; }
+    bool isInterleaved() const final { return GST_AUDIO_INFO_LAYOUT(&m_info) == GST_AUDIO_LAYOUT_INTERLEAVED; }
+    bool isSignedInteger() const final { return GST_AUDIO_INFO_IS_INTEGER(&m_info); }
+    bool isNativeEndian() const final { return GST_AUDIO_INFO_ENDIANNESS(&m_info) == G_BYTE_ORDER; }
+    bool isFloat() const final { return GST_AUDIO_INFO_IS_FLOAT(&m_info); }
+    int bytesPerFrame() { return GST_AUDIO_INFO_BPF(&m_info);  }
+
+    uint32_t numberOfInterleavedChannels() const final { return isInterleaved() ? GST_AUDIO_INFO_CHANNELS(&m_info) : TRUE; }
+    uint32_t numberOfChannelStreams() const final { return GST_AUDIO_INFO_CHANNELS(&m_info); }
+    uint32_t numberOfChannels() const final { return GST_AUDIO_INFO_CHANNELS(&m_info); }
+    uint32_t sampleWordSize() const final { return GST_AUDIO_INFO_BPS(&m_info); }
+
+    bool operator==(const GStreamerAudioStreamDescription& other) { return gst_audio_info_is_equal(&m_info, &other.m_info); }
+    bool operator!=(const GStreamerAudioStreamDescription& other) { return !operator == (other); }
+
+    GstCaps* caps() { return m_caps.get(); }
+    GstAudioInfo* getInfo() { return &m_info; }
+
+private:
+    GstAudioInfo m_info;
+    GRefPtr<GstCaps> m_caps;
+    mutable PlatformDescription m_platformDescription;
+};
+
+} // WebCore
+
+#endif // USE(GSTREAMER)

Deleted: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioData.h (269826 => 269827)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioData.h	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioData.h	2020-11-15 15:38:57 UTC (rev 269827)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2018 Metrological Group B.V.
- * Author: Thibault Saunier <[email protected]>
- * Author: Alejandro G. Castro <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#if ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
-
-#include "GRefPtrGStreamer.h"
-#include "PlatformAudioData.h"
-
-#include <gst/audio/audio.h>
-
-namespace WebCore {
-class GStreamerAudioData final : public PlatformAudioData {
-public:
-    GStreamerAudioData(GRefPtr<GstSample>&& sample, GstAudioInfo info)
-        : m_sample(WTFMove(sample))
-        , m_audioInfo(info)
-    {
-    }
-
-    GStreamerAudioData(GRefPtr<GstSample>&& sample)
-        : m_sample(WTFMove(sample))
-    {
-        gst_audio_info_from_caps(&m_audioInfo, gst_sample_get_caps(m_sample.get()));
-    }
-
-    GstSample* getSample() { return m_sample.get(); }
-    GstAudioInfo getAudioInfo() {return m_audioInfo; }
-
-private:
-    Kind kind() const { return Kind::GStreamerAudioData; }
-    GRefPtr<GstSample> m_sample;
-    GRefPtr<GstCaps> m_caps;
-
-    GstAudioInfo m_audioInfo;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)

Deleted: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h (269826 => 269827)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h	2020-11-15 15:38:57 UTC (rev 269827)
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2018 Metrological Group B.V.
- * Copyright (C) 2018, 2020 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * aint with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#if ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
-
-#include "AudioStreamDescription.h"
-#include "GStreamerCommon.h"
-#include <gst/audio/audio.h>
-
-namespace WebCore {
-
-class GStreamerAudioStreamDescription final: public AudioStreamDescription {
-public:
-    GStreamerAudioStreamDescription(GstAudioInfo info)
-        : m_info(info)
-        , m_caps(adoptGRef(gst_audio_info_to_caps(&m_info)))
-    {
-    }
-
-    GStreamerAudioStreamDescription(GstAudioInfo *info)
-        : m_info(*info)
-        , m_caps(adoptGRef(gst_audio_info_to_caps(&m_info)))
-    {
-    }
-
-    GStreamerAudioStreamDescription()
-    {
-        gst_audio_info_init(&m_info);
-    }
-
-    WEBCORE_EXPORT ~GStreamerAudioStreamDescription() { };
-
-    const PlatformDescription& platformDescription() const
-    {
-        m_platformDescription = { PlatformDescription::GStreamerAudioStreamDescription, reinterpret_cast<const AudioStreamBasicDescription*>(&m_info) };
-
-        return m_platformDescription;
-    }
-
-    WEBCORE_EXPORT PCMFormat format() const final {
-        switch (GST_AUDIO_INFO_FORMAT(&m_info)) {
-        case GST_AUDIO_FORMAT_S16LE:
-        case GST_AUDIO_FORMAT_S16BE:
-            return Int16;
-        case GST_AUDIO_FORMAT_S32LE:
-        case GST_AUDIO_FORMAT_S32BE:
-            return Int32;
-        case GST_AUDIO_FORMAT_F32LE:
-        case GST_AUDIO_FORMAT_F32BE:
-            return Float32;
-        case GST_AUDIO_FORMAT_F64LE:
-        case GST_AUDIO_FORMAT_F64BE:
-            return Float64;
-        default:
-            break;
-        }
-        return None;
-    }
-
-    double sampleRate() const final { return GST_AUDIO_INFO_RATE(&m_info); }
-    bool isPCM() const final { return format() != None; }
-    bool isInterleaved() const final { return GST_AUDIO_INFO_LAYOUT(&m_info) == GST_AUDIO_LAYOUT_INTERLEAVED; }
-    bool isSignedInteger() const final { return GST_AUDIO_INFO_IS_INTEGER(&m_info); }
-    bool isNativeEndian() const final { return GST_AUDIO_INFO_ENDIANNESS(&m_info) == G_BYTE_ORDER; }
-    bool isFloat() const final { return GST_AUDIO_INFO_IS_FLOAT(&m_info); }
-    int bytesPerFrame() { return GST_AUDIO_INFO_BPF(&m_info);  }
-
-    uint32_t numberOfInterleavedChannels() const final { return isInterleaved() ? GST_AUDIO_INFO_CHANNELS(&m_info) : TRUE; }
-    uint32_t numberOfChannelStreams() const final { return GST_AUDIO_INFO_CHANNELS(&m_info); }
-    uint32_t numberOfChannels() const final { return GST_AUDIO_INFO_CHANNELS(&m_info); }
-    uint32_t sampleWordSize() const final { return GST_AUDIO_INFO_BPS(&m_info); }
-
-    bool operator==(const GStreamerAudioStreamDescription& other) { return gst_audio_info_is_equal(&m_info, &other.m_info); }
-    bool operator!=(const GStreamerAudioStreamDescription& other) { return !operator == (other); }
-
-    GstCaps* caps() { return m_caps.get(); }
-    GstAudioInfo* getInfo() { return &m_info; }
-
-private:
-    GstAudioInfo m_info;
-    GRefPtr<GstCaps> m_caps;
-    mutable PlatformDescription m_platformDescription;
-};
-
-} // WebCore
-
-#endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp (269826 => 269827)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp	2020-11-15 14:25:42 UTC (rev 269826)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp	2020-11-15 15:38:57 UTC (rev 269827)
@@ -84,9 +84,11 @@
             nullptr));
     }
 
-    LockHolder locker(m_adapterMutex);
-    auto buffer = gst_sample_get_buffer(data.getSample());
-    gst_adapter_push(m_adapter.get(), gst_buffer_ref(buffer));
+    {
+        LockHolder locker(m_adapterMutex);
+        auto* buffer = gst_sample_get_buffer(data.getSample());
+        gst_adapter_push(m_adapter.get(), gst_buffer_ref(buffer));
+    }
     LibWebRTCProvider::callOnWebRTCSignalingThread([protectedThis = makeRef(*this)] {
         protectedThis->pullAudioData();
     });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to