wtay gst-plugins-good: gst-plugins-good/ gst-plugins-good/gst/rtp/

[email protected] Tue, 9 Dec 2008 06:19:30 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-good
Changes by:     wtay
Date:           Tue Dec 09 2008  14:19:30 UTC

Log message:
* gst/rtp/gstrtpjpegdepay.c: (gst_rtp_jpeg_depay_process):
Add an EOI marker at the end of the jpeg frame when it's missing.
Fixes #563056.

Modified files:
    .               : ChangeLog
    gst/rtp         : gstrtpjpegdepay.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/ChangeLog.diff?r1=1.3857&r2=1.3858
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-good/gst/rtp/gstrtpjpegdepay.c.diff?r1=1.1&r2=1.2

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-good/ChangeLog,v
retrieving revision 1.3857
retrieving revision 1.3858
diff -u -d -r1.3857 -r1.3858
--- ChangeLog	9 Dec 2008 10:47:13 -0000	1.3857
+++ ChangeLog	9 Dec 2008 14:19:11 -0000	1.3858
@@ -1,3 +1,9 @@
+2008-12-09  Wim Taymans  <[email protected]>
+
+	* gst/rtp/gstrtpjpegdepay.c: (gst_rtp_jpeg_depay_process):
+	Add an EOI marker at the end of the jpeg frame when it's missing.
+	Fixes #563056.
 2008-12-09  Sebastian Dröge  <[email protected]>
 
 	* tests/check/elements/videocrop.c: (check_1x1_buffer):
Index: gstrtpjpegdepay.c
RCS file: /cvs/gstreamer/gst-plugins-good/gst/rtp/gstrtpjpegdepay.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- gstrtpjpegdepay.c	14 Nov 2008 18:41:29 -0000	1.1
+++ gstrtpjpegdepay.c	9 Dec 2008 14:19:16 -0000	1.2
@@ -549,7 +549,6 @@
     GST_BUFFER_SIZE (outbuf) = size;
     gst_adapter_push (rtpjpegdepay->adapter, outbuf);
-
   }
   /* take JPEG data, push in the adapter */
@@ -560,12 +559,32 @@
   if (gst_rtp_buffer_get_marker (buf)) {
     guint avail;
+    guint8 end[2];
+    guint8 *data;
     /* last buffer take all data out of the adapter */
     avail = gst_adapter_available (rtpjpegdepay->adapter);
+    GST_DEBUG_OBJECT (rtpjpegdepay, "marker set, last buffer");
+    /* take the last bytes of the jpeg data to see if there is an EOI
+     * marker */
+    gst_adapter_copy (rtpjpegdepay->adapter, end, avail - 2, 2);
+    if (end[0] != 0xff && end[1] != 0xd9) {
+      GST_DEBUG_OBJECT (rtpjpegdepay, "no EOI marker, adding one");
+      /* no EOI marker, add one */
+      outbuf = gst_buffer_new_and_alloc (2);
+      data = GST_BUFFER_DATA (outbuf);
+      data[0] = 0xff;
+      data[1] = 0xd9;
+      gst_adapter_push (rtpjpegdepay->adapter, outbuf);
+      avail += 2;
+    }
     outbuf = gst_adapter_take_buffer (rtpjpegdepay->adapter, avail);
-    GST_DEBUG_OBJECT (rtpjpegdepay, "last buffer, returning %u bytes", avail);
+    GST_DEBUG_OBJECT (rtpjpegdepay, "returning %u bytes", avail);
   return outbuf;

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose