⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269827 in webkit


Ignore:
Timestamp:
Nov 15, 2020, 7:38:57 AM (6 years ago)
Author:
Philippe Normand
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.
Location:
trunk
Files:
1 added
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269820 r269827  
     12020-11-15  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] WebAudio to MediaStream support
     4        https://bugs.webkit.org/show_bug.cgi?id=218335
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        * platform/gtk/TestExpectations: webrtc/peer-connection-createMediaStreamDestination.html is now passing.
     9
    1102020-11-14  Rob Buis  <rbuis@igalia.com>
    211
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r269819 r269827  
    721721webkit.org/b/177533 webrtc/video-interruption.html
    722722
    723 webkit.org/b/186933 webrtc/peer-connection-createMediaStreamDestination.html
    724 
    725723imported/w3c/web-platform-tests/webrtc/ [ Skip ]
    726724http/tests/webrtc [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r269826 r269827  
     12020-11-15  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] WebAudio to MediaStream support
     4        https://bugs.webkit.org/show_bug.cgi?id=218335
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Provide audio samples coming from the WebAudio bus to the MediaStreamAudioSource node, using
     9        GStreamer. This patch also moves a couple files from platform/mediastream to platform/audio,
     10        because this is where the virtual parent classes are defined.
     11
     12        * Modules/webaudio/MediaStreamAudioSource.cpp:
     13        * Modules/webaudio/MediaStreamAudioSource.h:
     14        * Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp: Added.
     15        (WebCore::copyBusData):
     16        (WebCore::MediaStreamAudioSource::consumeAudio):
     17        * platform/GStreamer.cmake:
     18        * platform/audio/gstreamer/GStreamerAudioData.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioData.h.
     19        (isType):
     20        * platform/audio/gstreamer/GStreamerAudioStreamDescription.h: Renamed from Source/WebCore/platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h.
     21        * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
     22        (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::audioSamplesAvailable):
     23        (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData):
     24
    1252020-11-15  Zalan Bujtas  <zalan@apple.com>
    226
  • trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp

    r261626 r269827  
    5858}
    5959
    60 #if !PLATFORM(COCOA)
     60#if !PLATFORM(COCOA) && !USE(GSTREAMER)
    6161void MediaStreamAudioSource::consumeAudio(AudioBus&, size_t)
    6262{
  • trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.h

    r261626 r269827  
    6161    RealtimeMediaSourceSettings m_currentSettings;
    6262    std::unique_ptr<PlatformAudioData> m_audioBuffer;
    63 #if USE(AVFOUNDATION)
     63#if USE(AVFOUNDATION) || USE(GSTREAMER)
    6464    size_t m_numberOfFrames { 0 };
    6565#endif
  • trunk/Source/WebCore/platform/GStreamer.cmake

    r267787 r269827  
    77
    88    list(APPEND WebCore_SOURCES
     9        Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp
    910        platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp
    1011        platform/graphics/gstreamer/GLVideoSinkGStreamer.cpp
  • trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioData.h

    r269826 r269827  
    2222#pragma once
    2323
    24 #if ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
     24#if USE(GSTREAMER)
    2525
    2626#include "GRefPtrGStreamer.h"
     
    3030
    3131namespace WebCore {
     32
    3233class GStreamerAudioData final : public PlatformAudioData {
    3334public:
     
    4445    }
    4546
     47    void setSample(GRefPtr<GstSample>&& sample) { m_sample = WTFMove(sample); }
    4648    GstSample* getSample() { return m_sample.get(); }
    47     GstAudioInfo getAudioInfo() {return m_audioInfo; }
     49    GstAudioInfo getAudioInfo() { return m_audioInfo; }
     50    uint32_t channelCount() const { return GST_AUDIO_INFO_CHANNELS(&m_audioInfo); }
    4851
    4952private:
    5053    Kind kind() const { return Kind::GStreamerAudioData; }
    5154    GRefPtr<GstSample> m_sample;
    52     GRefPtr<GstCaps> m_caps;
    53 
    5455    GstAudioInfo m_audioInfo;
    5556};
     
    5758} // namespace WebCore
    5859
    59 #endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
     60SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::GStreamerAudioData)
     61static bool isType(const WebCore::PlatformAudioData& data) { return data.kind() == WebCore::PlatformAudioData::Kind::GStreamerAudioData; }
     62SPECIALIZE_TYPE_TRAITS_END()
     63
     64#endif // USE(GSTREAMER)
  • trunk/Source/WebCore/platform/audio/gstreamer/GStreamerAudioStreamDescription.h

    r269826 r269827  
    2121#pragma once
    2222
    23 #if ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
     23#if USE(GSTREAMER)
    2424
    2525#include "AudioStreamDescription.h"
     
    4848    }
    4949
    50     WEBCORE_EXPORT ~GStreamerAudioStreamDescription() { };
     50    ~GStreamerAudioStreamDescription() = default;
    5151
    5252    const PlatformDescription& platformDescription() const
     
    5757    }
    5858
    59     WEBCORE_EXPORT PCMFormat format() const final {
     59    PCMFormat format() const final
     60    {
    6061        switch (GST_AUDIO_INFO_FORMAT(&m_info)) {
    6162        case GST_AUDIO_FORMAT_S16LE:
     
    104105} // WebCore
    105106
    106 #endif // ENABLE(MEDIA_STREAM) && USE(GSTREAMER)
     107#endif // USE(GSTREAMER)
  • trunk/Source/WebCore/platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp

    r264762 r269827  
    8585    }
    8686
    87     LockHolder locker(m_adapterMutex);
    88     auto buffer = gst_sample_get_buffer(data.getSample());
    89     gst_adapter_push(m_adapter.get(), gst_buffer_ref(buffer));
     87    {
     88        LockHolder locker(m_adapterMutex);
     89        auto* buffer = gst_sample_get_buffer(data.getSample());
     90        gst_adapter_push(m_adapter.get(), gst_buffer_ref(buffer));
     91    }
    9092    LibWebRTCProvider::callOnWebRTCSignalingThread([protectedThis = makeRef(*this)] {
    9193        protectedThis->pullAudioData();
Note: See TracChangeset for help on using the changeset viewer.