mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
srtpenc: also insert ssrc(s) from rtp buffers
This fixes a regression from commit "srtp: Support libsrtp2"
e9aa117200
where an internal
set of ssrc(s) was added because the libsrtp v2 keeps its
internal streams as private. But the change prevented that
ssrc(s) that not in the caps from being added to the stats.
This patch ensures that all ssrc(s) are inserted to this set
instead of only inserting those from the caps.
This commit is contained in:
parent
9fcd3bdd2b
commit
2b9c7bff45
1 changed files with 26 additions and 1 deletions
|
@ -820,6 +820,16 @@ get_rtp_other_pad (GstPad * pad)
|
|||
return GST_PAD (gst_pad_get_element_private (pad));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_srtp_enc_add_ssrc (GstSrtpEnc * filter, guint ssrc)
|
||||
{
|
||||
gboolean is_added =
|
||||
g_hash_table_add (filter->ssrcs_set, GUINT_TO_POINTER (ssrc));
|
||||
if (is_added) {
|
||||
GST_DEBUG_OBJECT (filter, "Added ssrc %u", ssrc);
|
||||
}
|
||||
}
|
||||
|
||||
/* Release a sink pad and it's linked source pad
|
||||
*/
|
||||
static void
|
||||
|
@ -872,7 +882,7 @@ gst_srtp_enc_sink_setcaps (GstPad * pad, GstSrtpEnc * filter,
|
|||
if (gst_structure_has_field_typed (ps, "ssrc", G_TYPE_UINT)) {
|
||||
guint ssrc;
|
||||
gst_structure_get_uint (ps, "ssrc", &ssrc);
|
||||
g_hash_table_add (filter->ssrcs_set, GUINT_TO_POINTER (ssrc));
|
||||
gst_srtp_enc_add_ssrc (filter, ssrc);
|
||||
}
|
||||
|
||||
if (HAS_CRYPTO (filter))
|
||||
|
@ -1097,6 +1107,18 @@ gst_srtp_enc_check_set_caps (GstSrtpEnc * filter, GstPad * pad,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_srtp_enc_ensure_ssrc (GstSrtpEnc * filter, GstBuffer * buf)
|
||||
{
|
||||
GstRTPBuffer rtpbuf = GST_RTP_BUFFER_INIT;
|
||||
if (gst_rtp_buffer_map (buf,
|
||||
GST_MAP_READ | GST_RTP_BUFFER_MAP_FLAG_SKIP_PADDING, &rtpbuf)) {
|
||||
guint32 ssrc = gst_rtp_buffer_get_ssrc (&rtpbuf);
|
||||
gst_srtp_enc_add_ssrc (filter, ssrc);
|
||||
gst_rtp_buffer_unmap (&rtpbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_srtp_enc_process_buffer (GstSrtpEnc * filter, GstPad * pad,
|
||||
GstBuffer * buf, gboolean is_rtcp, GstBuffer ** outbuf_ptr)
|
||||
|
@ -1126,6 +1148,9 @@ gst_srtp_enc_process_buffer (GstSrtpEnc * filter, GstPad * pad,
|
|||
ret = GST_FLOW_FLUSHING;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
gst_srtp_enc_ensure_ssrc (filter, buf);
|
||||
|
||||
#ifdef HAVE_SRTP2
|
||||
if (is_rtcp)
|
||||
err = srtp_protect_rtcp_mki (filter->session, mapout.data, &size,
|
||||
|
|
Loading…
Reference in a new issue