rtpasfdepay: avoid re-sending header

... e.g. following a seek, which otherwise confuses downstream demuxer
expecting only a flow of data packets at this time.
This commit is contained in:
Mark Nauwelaerts 2011-04-27 15:14:00 +02:00
parent 81f62a987a
commit 4f2627e737

View file

@ -157,7 +157,17 @@ gst_rtp_asf_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
if (ps_string == NULL || *ps_string == '\0')
goto no_packetsize;
depay->packet_size = atoi (ps_string);
if (depay->packet_size) {
/* header sent again following seek;
* discard to avoid confusing upstream */
if (depay->packet_size == atoi (ps_string)) {
goto duplicate_header;
} else {
/* since we should fiddle with downstream state to handle this */
goto refuse_renegotiation;
}
} else
depay->packet_size = atoi (ps_string);
if (depay->packet_size <= 16)
goto invalid_packetsize;
@ -203,6 +213,16 @@ invalid_headers:
g_free (headers);
return FALSE;
}
duplicate_header:
{
GST_DEBUG_OBJECT (depayload, "discarding duplicate header");
return TRUE;
}
refuse_renegotiation:
{
GST_WARNING_OBJECT (depayload, "cannot renegotiate to different header");
return FALSE;
}
}
static gint