diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-01-30 18:43:30 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2016-04-06 10:56:14 +0100 |
commit | c23733a88cdf64df5d14ba2c4ff8d4f9daa725b2 (patch) | |
tree | 16e3f73d0a86e4d9b4a4543973c64b1248ba8210 | |
parent | c51c2c8cbba24c942a3ed4b7fe6eecad97f70e34 (diff) | |
download | gstreamer-plugins-good-c23733a88cdf64df5d14ba2c4ff8d4f9daa725b2.tar.gz |
rtpjpegpay: Skip APP and JPG markers and print warnings for unknown markers
For APP/JPG markers the size is following and we have to skip that. This is
not really a problem unless the marker contains e.g. a preview JPEG or
something else that we might interprete as another marker.
-rw-r--r-- | gst/rtp/gstrtpjpegpay.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gst/rtp/gstrtpjpegpay.c b/gst/rtp/gstrtpjpegpay.c index 65fcb172f..804b8c72e 100644 --- a/gst/rtp/gstrtpjpegpay.c +++ b/gst/rtp/gstrtpjpegpay.c @@ -107,10 +107,15 @@ enum _RtpJpegMarker JPEG_MARKER_DQT = 0xDB, JPEG_MARKER_SOF = 0xC0, JPEG_MARKER_DHT = 0xC4, + JPEG_MARKER_JPG = 0xC8, JPEG_MARKER_SOS = 0xDA, JPEG_MARKER_EOI = 0xD9, JPEG_MARKER_DRI = 0xDD, - JPEG_MARKER_H264 = 0xE4 + JPEG_MARKER_APP0 = 0xE0, + JPEG_MARKER_H264 = 0xE4, /* APP4 */ + JPEG_MARKER_APP15 = 0xEF, + JPEG_MARKER_JPG0 = 0xF0, + JPEG_MARKER_JPG13 = 0xFD }; #define DEFAULT_JPEG_QUANT 255 @@ -714,8 +719,10 @@ gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload, dri_found = FALSE; while (!sos_found && (offset < size)) { + gint marker; + GST_LOG_OBJECT (pay, "checking from offset %u", offset); - switch (gst_rtp_jpeg_pay_scan_marker (data, size, &offset)) { + switch ((marker = gst_rtp_jpeg_pay_scan_marker (data, size, &offset))) { case JPEG_MARKER_JFIF: case JPEG_MARKER_CMT: case JPEG_MARKER_DHT: @@ -752,6 +759,14 @@ gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload, dri_found = TRUE; break; default: + if (marker == JPEG_MARKER_JPG || + (marker >= JPEG_MARKER_JPG0 && marker <= JPEG_MARKER_JPG13) || + (marker >= JPEG_MARKER_APP0 && marker <= JPEG_MARKER_APP15)) { + GST_LOG_OBJECT (pay, "skipping marker"); + offset += gst_rtp_jpeg_pay_header_size (data, offset); + } else { + GST_FIXME_OBJECT (pay, "unhandled marker 0x%02x", marker); + } break; } } |