webrtcbin, rtpbin: check before setting properties on jitterbuffer

In rtpbin we already systematically check for all property names
except latency, correct that.

In webrtcbin we need to check before trying to use the do-retransmission
property.

This is useful for the case where an element like identity gets passed
to rtpbin's request-jitterbuffer property, when the application wants
to use webrtcbin in an SFU situation, with no reordering and no added
latency

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6112>
This commit is contained in:
Mathieu Duponchelle 2024-02-13 18:57:05 +01:00 committed by GStreamer Marge Bot
parent c726add352
commit 91317aacaf
2 changed files with 19 additions and 8 deletions

View file

@ -7866,6 +7866,7 @@ jitter_buffer_set_retransmission (SsrcMapItem * item,
{
GstWebRTCRTPTransceiver *trans;
gboolean do_nack;
GObjectClass *jb_class;
if (item->media_idx == -1)
return TRUE;
@ -7876,13 +7877,23 @@ jitter_buffer_set_retransmission (SsrcMapItem * item,
return TRUE;
}
jb_class = G_OBJECT_GET_CLASS (G_OBJECT (data->jitterbuffer));
do_nack = WEBRTC_TRANSCEIVER (trans)->do_nack;
/* We don't set do-retransmission on rtpbin as we want per-session control */
GST_LOG_OBJECT (data->webrtc, "setting do-nack=%s for transceiver %"
GST_PTR_FORMAT " with transport %" GST_PTR_FORMAT
" rtp session %u ssrc %u", do_nack ? "true" : "false", trans,
data->stream, data->stream->session_id, data->ssrc);
g_object_set (data->jitterbuffer, "do-retransmission", do_nack, NULL);
if (g_object_class_find_property (jb_class, "do-retransmission")) {
/* We don't set do-retransmission on rtpbin as we want per-session control */
GST_LOG_OBJECT (data->webrtc, "setting do-nack=%s for transceiver %"
GST_PTR_FORMAT " with transport %" GST_PTR_FORMAT
" rtp session %u ssrc %u", do_nack ? "true" : "false", trans,
data->stream, data->stream->session_id, data->ssrc);
g_object_set (data->jitterbuffer, "do-retransmission", do_nack, NULL);
} else if (do_nack) {
GST_WARNING_OBJECT (data->webrtc, "Not setting do-nack for transceiver %"
GST_PTR_FORMAT " with transport %" GST_PTR_FORMAT
" rtp session %u ssrc %u"
" as its jitterbuffer does not have a do-retransmission property",
trans, data->stream, data->stream->session_id, data->ssrc);
}
g_weak_ref_set (&item->rtpjitterbuffer, data->jitterbuffer);

View file

@ -1967,8 +1967,8 @@ create_stream (GstRtpBinSession * session, guint32 ssrc)
g_object_set_data (G_OBJECT (buffer), "GstRTPBin.stream", stream);
/* configure latency and packet lost */
g_object_set (buffer, "latency", rtpbin->latency_ms, NULL);
if (g_object_class_find_property (jb_class, "latency"))
g_object_set (buffer, "latency", rtpbin->latency_ms, NULL);
if (g_object_class_find_property (jb_class, "drop-on-latency"))
g_object_set (buffer, "drop-on-latency", rtpbin->drop_on_latency, NULL);
if (g_object_class_find_property (jb_class, "do-lost"))