rtpjpegdepay didn't handle fragment lost case properly?

cee1 fykcee1 at gmail.com
Thu Mar 14 01:28:51 PDT 2013


Hi all,

We build a pipeline: udpsrc caps="application/x-rtp" ! rtpjitterbuffer
! rtpjpegdepay ! ffdec_mjpeg ! autovideosink, and this receive side
always quits with "ffdec_mjpeg: input format was not set before data
start".

We've checked the implementation of rtpjpegdepay, and find the
following change fixes it:
diff --git a/gst/rtp/gstrtpjpegdepay.c b/gst/rtp/gstrtpjpegdepay.c
index 3c84397..a7e3323 100644
--- a/gst/rtp/gstrtpjpegdepay.c
+++ b/gst/rtp/gstrtpjpegdepay.c
@@ -605,23 +605,23 @@ gst_rtp_jpeg_depay_process (GstBaseRTPDepayload
* depayload, GstBuffer * buf)
     precision = 0;
   }

+  if (rtpjpegdepay->width != width || rtpjpegdepay->height != height) {
+    GstCaps *outcaps;
+
+    outcaps =
+        gst_caps_new_simple ("image/jpeg", "framerate", GST_TYPE_FRACTION,
+        rtpjpegdepay->frate_num, rtpjpegdepay->frate_denom, "width",
+        G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
+    gst_pad_set_caps (depayload->srcpad, outcaps);
+    gst_caps_unref (outcaps);
+
+    rtpjpegdepay->width = width;
+    rtpjpegdepay->height = height;
+  }
+
   if (frag_offset == 0) {
     guint size;

-    if (rtpjpegdepay->width != width || rtpjpegdepay->height != height) {
-      GstCaps *outcaps;
-
-      outcaps =
-          gst_caps_new_simple ("image/jpeg", "framerate", GST_TYPE_FRACTION,
-          rtpjpegdepay->frate_num, rtpjpegdepay->frate_denom, "width",
-          G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
-      gst_pad_set_caps (depayload->srcpad, outcaps);
-      gst_caps_unref (outcaps);
-
-      rtpjpegdepay->width = width;
-      rtpjpegdepay->height = height;
-    }
-
     GST_LOG_OBJECT (rtpjpegdepay, "first packet, length %" G_GUINT16_FORMAT,
         length);


Seems rtpjpegdepay will only set caps for ffdec_mjpeg when a)it's the
first fragment of a packet and b) this packet has different dimension
with previous one's.

What if missing the first fragment of a packet? We guess this caused
our problem.

BTW, what will rtpjpegdepay do if missing a middle fragment of a
packet? Should the whole packet be dropped?



-- 
Regards,

- cee1


More information about the gstreamer-devel mailing list