mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
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.
This commit is contained in:
parent
c979a9cdc3
commit
1691683883
2 changed files with 27 additions and 2 deletions
|
@ -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):
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue