]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugins-ugly0-10.git/blobdiff - gst/asfdemux/gstrtpasfdepay.c
rtpasfdepay: avoid re-sending header
[glsdk/gst-plugins-ugly0-10.git] / gst / asfdemux / gstrtpasfdepay.c
index e53746fe52a2922a5f7262105e9dab38fa01d48b..08cfe4471e76547fabff4e3a42bdfb541113ff29 100644 (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