diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-12-09 14:19:16 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-12-09 14:19:16 +0000 |
commit | 16916838831d489b0dfc2535d2d40f582193caed (patch) | |
tree | e139a477878fcf015d914af0b469e4811cf85334 /gst/rtp | |
parent | c979a9cdc37bd9665f03fc1143c2ef8bb3dc1924 (diff) |
gst/rtp/gstrtpjpegdepay.c: Add an EOI marker at the end of the jpeg frame when it's missing.
Original commit message from CVS:
* 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.
Diffstat (limited to 'gst/rtp')
-rw-r--r-- | gst/rtp/gstrtpjpegdepay.c | 23 |
1 files changed, 21 insertions, 2 deletions
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; |