Bug 218335

Summary: [GStreamer] WebAudio to MediaStream support
Product: WebKit Reporter: Philippe Normand <pnormand>
Component: PlatformAssignee: Philippe Normand <pnormand>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, calvaris, eric.carlson, ews-watchlist, glenn, gyuyoung.kim, hta, jer.noble, philipj, ryuan.choi, sergio, tommyw, vjaquez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=186933
Attachments:
Description Flags
Patch calvaris: review+

Description Philippe Normand 2020-10-29 05:34:03 PDT
webrtc/peer-connection-createMediaStreamDestination.html from webkit.org/b/186933 is still failing.
Comment 1 Philippe Normand 2020-10-29 06:21:40 PDT
Created attachment 412638 [details]
Patch
Comment 2 Xabier Rodríguez Calvar 2020-10-30 08:38:47 PDT
Comment on attachment 412638 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412638&action=review

> Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp:40
> +    gsize size = mappedBuffer.size() / bus.numberOfChannels();

size_t

> Source/WebCore/Modules/webaudio/MediaStreamAudioSourceGStreamer.cpp:61
> +    gsize size = GST_AUDIO_INFO_BPF(&info) * bus.numberOfChannels() * numberOfFrames;

size_t

> Source/WebCore/platform/audio/gstreamer/GStreamerAudioData.h:35
> +    GStreamerAudioData(GRefPtr<GstSample>&& sample, GstAudioInfo info)

GstAudioInfo&& and move into this from the caller and into m_audioInfo

> Source/WebCore/platform/audio/gstreamer/GStreamerAudioData.h:49
> +    GstSample* getSample() { return m_sample.get(); }
> +    GstAudioInfo getAudioInfo() { return m_audioInfo; }

const GstAudioInfo& audioInfo() const

and I would also do const GRefPrt<GstSample>& sample() const;

> Source/WebCore/platform/audio/gstreamer/GStreamerAudioStreamDescription.h:33
> +    GStreamerAudioStreamDescription(GstAudioInfo info)

GstAudioInfo&& and move here and at the caller. Let's save some copy.

> Source/WebCore/platform/audio/gstreamer/GStreamerAudioStreamDescription.h:40
> +    GStreamerAudioStreamDescription(GstAudioInfo *info)
> +        : m_info(*info)

If you do the change I recommend above, you can make this const GstAudioInfo& and m_info(info), forcing a copy. I think it is cleaner.

> Source/WebCore/platform/audio/gstreamer/GStreamerAudioStreamDescription.h:97
> +    GstCaps* caps() { return m_caps.get(); }
> +    GstAudioInfo* getInfo() { return &m_info; }

const GstAudioInfo& info() const

and I would also do const GRefPtr<GstCaps>& caps() const;
Comment 3 Philippe Normand 2020-10-30 08:48:33 PDT
These changes you want will likely require updates in code unrelated with this patch, so I'd rather do this in a follow-up bug.
Comment 4 Philippe Normand 2020-11-15 07:39:34 PST
Committed r269827: <https://trac.webkit.org/changeset/269827>
Comment 5 Radar WebKit Bug Importer 2020-11-15 07:40:17 PST
<rdar://problem/71414788>