Skip to content

Commit

Permalink
Cherry-pick 275162@main (429961d). https://bugs.webkit.org/show_bug.c…
Browse files Browse the repository at this point in the history
…gi?id=269840

    [LibWebRTC][GStreamer] Incoming audio stream clips and glitches
    https://bugs.webkit.org/show_bug.cgi?id=269840

    Reviewed by Xabier Rodriguez-Calvar.

    Add audio meta to incoming audio buffers so that downstream converters don't produce garbage.

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

    Canonical link: https://commits.webkit.org/275162@main

Canonical link: https://commits.webkit.org/274313.177@webkitglib/2.44
  • Loading branch information
philn authored and aperezdc committed Apr 28, 2024
1 parent cef9106 commit 1a7ce9a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ void RealtimeIncomingAudioSourceLibWebRTC::OnData(const void* audioData, int, in
gst_audio_info_set_format(&info, format, sampleRate, numberOfChannels, NULL);

auto bufferSize = GST_AUDIO_INFO_BPF(&info) * numberOfFrames;
auto buffer = adoptGRef(gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, const_cast<gpointer>(audioData), bufferSize, 0, bufferSize, nullptr, nullptr));
auto buffer = adoptGRef(gst_buffer_new_memdup(const_cast<gpointer>(audioData), bufferSize));
gst_buffer_add_audio_meta(buffer.get(), &info, numberOfFrames, 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);
Expand Down

0 comments on commit 1a7ce9a

Please sign in to comment.