mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
rtpsource/rtprtxsend: Also pass correct seqnum-offset and payload to the RTX rtpsource
https://bugzilla.gnome.org/show_bug.cgi?id=747394
This commit is contained in:
parent
26bec72e52
commit
80268e7d37
2 changed files with 36 additions and 8 deletions
|
@ -121,7 +121,7 @@ buffer_queue_item_free (BufferQueueItem * item)
|
|||
typedef struct
|
||||
{
|
||||
guint32 rtx_ssrc;
|
||||
guint16 next_seqnum;
|
||||
guint16 seqnum_base, next_seqnum;
|
||||
gint clock_rate;
|
||||
|
||||
/* history of rtp packets */
|
||||
|
@ -134,7 +134,7 @@ ssrc_rtx_data_new (guint32 rtx_ssrc)
|
|||
SSRCRtxData *data = g_slice_new0 (SSRCRtxData);
|
||||
|
||||
data->rtx_ssrc = rtx_ssrc;
|
||||
data->next_seqnum = g_random_int_range (0, G_MAXUINT16);
|
||||
data->next_seqnum = data->seqnum_base = g_random_int_range (0, G_MAXUINT16);
|
||||
data->queue = g_sequence_new ((GDestroyNotify) buffer_queue_item_free);
|
||||
|
||||
return data;
|
||||
|
@ -593,22 +593,44 @@ gst_rtp_rtx_send_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
GstCaps *caps;
|
||||
GstStructure *s;
|
||||
guint ssrc;
|
||||
gint payload;
|
||||
gpointer rtx_payload;
|
||||
SSRCRtxData *data;
|
||||
|
||||
gst_event_parse_caps (event, &caps);
|
||||
g_assert (gst_caps_is_fixed (caps));
|
||||
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
if (!gst_structure_get_uint (s, "ssrc", &ssrc))
|
||||
ssrc = -1;
|
||||
if (!gst_structure_get_int (s, "payload", &payload))
|
||||
payload = -1;
|
||||
|
||||
if (payload == -1)
|
||||
GST_WARNING_OBJECT (rtx, "No payload in caps");
|
||||
|
||||
GST_OBJECT_LOCK (rtx);
|
||||
data = gst_rtp_rtx_send_get_ssrc_data (rtx, ssrc);
|
||||
if (!g_hash_table_lookup_extended (rtx->rtx_pt_map,
|
||||
GUINT_TO_POINTER (payload), NULL, &rtx_payload))
|
||||
rtx_payload = GINT_TO_POINTER (-1);
|
||||
|
||||
if (GPOINTER_TO_INT (rtx_payload) == -1 && payload != -1)
|
||||
GST_WARNING_OBJECT (rtx, "Payload %d not in rtx-pt-map", payload);
|
||||
|
||||
GST_DEBUG_OBJECT (rtx,
|
||||
"got caps for payload: %d->%d, ssrc: %u->%d: %" GST_PTR_FORMAT,
|
||||
payload, GPOINTER_TO_INT (rtx_payload), ssrc, data->rtx_ssrc, caps);
|
||||
|
||||
gst_structure_get_int (s, "clock-rate", &data->clock_rate);
|
||||
|
||||
/* The session might need to know the RTX ssrc */
|
||||
caps = gst_caps_copy (caps);
|
||||
gst_caps_set_simple (caps, "rtx-ssrc", G_TYPE_UINT, data->rtx_ssrc, NULL);
|
||||
gst_caps_set_simple (caps, "rtx-ssrc", G_TYPE_UINT, data->rtx_ssrc,
|
||||
"rtx-seqnum-offset", G_TYPE_UINT, data->seqnum_base, NULL);
|
||||
|
||||
if (GPOINTER_TO_INT (rtx_payload) != -1)
|
||||
gst_caps_set_simple (caps, "rtx-payload", G_TYPE_INT,
|
||||
GPOINTER_TO_INT (rtx_payload), NULL);
|
||||
|
||||
GST_DEBUG_OBJECT (rtx, "got clock-rate from caps: %d for ssrc: %u",
|
||||
data->clock_rate, ssrc);
|
||||
|
|
|
@ -748,6 +748,7 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps)
|
|||
GstStructure *s;
|
||||
guint val;
|
||||
gint ival;
|
||||
gboolean rtx;
|
||||
|
||||
/* nothing changed, return */
|
||||
if (caps == NULL || src->caps == caps)
|
||||
|
@ -755,11 +756,14 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps)
|
|||
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
|
||||
if (gst_structure_get_int (s, "payload", &ival))
|
||||
rtx = (gst_structure_get_uint (s, "rtx-ssrc", &val) && val == src->ssrc);
|
||||
|
||||
if (gst_structure_get_int (s, rtx ? "rtx-payload" : "payload", &ival))
|
||||
src->payload = ival;
|
||||
else
|
||||
src->payload = -1;
|
||||
GST_DEBUG ("got payload %d", src->payload);
|
||||
|
||||
GST_DEBUG ("got %spayload %d", rtx ? "rtx " : "", src->payload);
|
||||
|
||||
if (gst_structure_get_int (s, "clock-rate", &ival))
|
||||
src->clock_rate = ival;
|
||||
|
@ -768,12 +772,14 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps)
|
|||
|
||||
GST_DEBUG ("got clock-rate %d", src->clock_rate);
|
||||
|
||||
if (gst_structure_get_uint (s, "seqnum-offset", &val))
|
||||
if (gst_structure_get_uint (s, rtx ? "rtx-seqnum-offset" : "seqnum-offset",
|
||||
&val))
|
||||
src->seqnum_offset = val;
|
||||
else
|
||||
src->seqnum_offset = -1;
|
||||
|
||||
GST_DEBUG ("got seqnum-offset %" G_GINT32_FORMAT, src->seqnum_offset);
|
||||
GST_DEBUG ("got %sseqnum-offset %" G_GINT32_FORMAT, rtx ? "rtx " : "",
|
||||
src->seqnum_offset);
|
||||
|
||||
gst_caps_replace (&src->caps, caps);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue