Update WebRTC transceivers dynamically

Matthew Waters ystreet00 at gmail.com
Sun Feb 20 12:22:44 UTC 2022


Nothing has to be unlinked to not send data.  It is entirely possible to
have things linked and not data flowing.  You can drop data manually
with a pad probe, or you could change the element states to not have
them producing data.  It all depends on what your exact requirements and
elements involved are.

Cheers
-Matt

On 18/2/22 20:37, Busayo Famutimi wrote:
> Thanks Matthew.
>
> Just to understand clearly, I have the following in a pipeline,
>
> "wasapisrc role=comms use-audioclient3=true low-latency=true ! queue !
> audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay
> name=audiopay ! queue name=audio_queue !
> application/x-rtp,media=audio,encoding-name=OPUS,payload=111 !
> webrtcbin ".
>
> To mute, the queue (named audio_queue) src pad and the
> webrtcbin sink_pad (sink_%u) have to be unlinked and
>
> to unmute, both pads must be linked back together.
>
> Is my understanding correct?
>
> Thanks.
>
>
>
>
> On Fri, Feb 18, 2022 at 2:53 AM Matthew Waters <ystreet00 at gmail.com>
> wrote:
>
>     Setting the sendrecv/recvonly/sendonly does not change what data
>     you push into webrtcbin.  If you want 'mute' functionality, stop
>     pushing audio/video into webrtcbin.
>
>     Cheers
>     -Matt
>
>     On 18/2/22 05:15, Busayo Famutimi via gstreamer-devel wrote:
>>     Hello.
>>
>>     Please I have a working webrtc peer connection using. However, I
>>     am unable to set the transceivers (both audio and video) dynamically.
>>
>>     I have the following code:
>>
>>     GArray *transceivers;
>>         g_signal_emit_by_name(voip_data->webrtc, "get-transceivers",
>>     &transceivers);
>>         g_assert(transceivers != NULL && transceivers->len > 1);
>>         for (guint i = 0; i < transceivers->len; i++)
>>         {
>>             GstWebRTCRTPTransceiver *transceiver =
>>     g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
>>             GstWebRTCKind kind;
>>             g_object_get(transceiver, "kind", &kind, NULL);
>>             if (kind == GST_WEBRTC_KIND_AUDIO)
>>             {
>>                 if (mic_action == MUTE_MIC)
>>                     g_object_set(transceiver, "direction",
>>     GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY, NULL);
>>                 else if (mic_action == UNMUTE_MIC)
>>                     g_object_set(transceiver, "direction",
>>     GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV, NULL);
>>                 else
>>                     g_assert_not_reached();
>>             }
>>         }
>>         g_array_unref(transceivers);
>>
>>     but the other peer still receives audio.
>>
>>     I am trying to create the mute/unmute microphone functionality.
>>
>>     How can this be achieved?
>>
>>     Thanks.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220220/79a61860/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220220/79a61860/attachment-0001.sig>


More information about the gstreamer-devel mailing list