Update WebRTC transceivers dynamically

Busayo Famutimi famutimi.busayo at gmail.com
Thu Feb 17 18:15:15 UTC 2022


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/20220217/3142c8b9/attachment-0001.htm>


More information about the gstreamer-devel mailing list