From 4f2627e7376c02a3cbd2375397ac9e67be177360 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 27 Apr 2011 15:14:00 +0200 Subject: [PATCH] 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. --- gst/asfdemux/gstrtpasfdepay.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gst/asfdemux/gstrtpasfdepay.c b/gst/asfdemux/gstrtpasfdepay.c index e53746fe52..08cfe4471e 100644 --- a/gst/asfdemux/gstrtpasfdepay.c +++ b/gst/asfdemux/gstrtpasfdepay.c @@ -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