summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--gst/rtp/gstrtpjpegdepay.c23
2 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e6ef952c..020f6cce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-09 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * 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 <sebastian.droege@collabora.co.uk>
* tests/check/elements/videocrop.c: (check_1x1_buffer):
diff --git a/gst/rtp/gstrtpjpegdepay.c b/gst/rtp/gstrtpjpegdepay.c
index 17fbe120..44f2dde0 100644
--- a/gst/rtp/gstrtpjpegdepay.c
+++ b/gst/rtp/gstrtpjpegdepay.c
@@ -549,7 +549,6 @@ gst_rtp_jpeg_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
GST_BUFFER_SIZE (outbuf) = size;
gst_adapter_push (rtpjpegdepay->adapter, outbuf);
-
}
/* take JPEG data, push in the adapter */
@@ -560,12 +559,32 @@ gst_rtp_jpeg_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
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;