mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
rtpjpegpay: Allow U and V components to use different quant tables if they contain the same data
This allows some cameras (Logitech C920) that specify different quant tables but both with the same data, to work. Bug reported by Robert Krakora
This commit is contained in:
parent
95f6e0dbe4
commit
7703a11073
1 changed files with 16 additions and 4 deletions
|
@ -417,7 +417,8 @@ no_table:
|
|||
|
||||
static gboolean
|
||||
gst_rtp_jpeg_pay_read_sof (GstRtpJPEGPay * pay, const guint8 * data,
|
||||
guint size, guint * offset, CompInfo info[])
|
||||
guint size, guint * offset, CompInfo info[], RtpQuantTable tables[],
|
||||
gulong tables_elements)
|
||||
{
|
||||
guint sof_size, off;
|
||||
guint width, height, infolen;
|
||||
|
@ -495,8 +496,18 @@ gst_rtp_jpeg_pay_read_sof (GstRtpJPEGPay * pay, const guint8 * data,
|
|||
|
||||
/* the other components are free to use any quant table but they have to
|
||||
* have the same table id */
|
||||
if (info[1].qt != info[2].qt)
|
||||
goto invalid_comp;
|
||||
if (info[1].qt != info[2].qt) {
|
||||
/* Some MJPG (like the one from the Logitech C-920 camera) uses different
|
||||
* quant tables for component 1 and 2 but both tables contain the exact
|
||||
* same data, so we could consider them as being the same tables */
|
||||
if (!(info[1].qt < tables_elements &&
|
||||
info[2].qt < tables_elements &&
|
||||
tables[info[1].qt].size > 0 &&
|
||||
tables[info[1].qt].size == tables[info[2].qt].size &&
|
||||
memcmp (tables[info[1].qt].data, tables[info[2].qt].data,
|
||||
tables[info[1].qt].size) == 0))
|
||||
goto invalid_comp;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
|
@ -648,7 +659,8 @@ gst_rtp_jpeg_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
|||
offset += gst_rtp_jpeg_pay_header_size (data, offset);
|
||||
break;
|
||||
case JPEG_MARKER_SOF:
|
||||
if (!gst_rtp_jpeg_pay_read_sof (pay, data, size, &offset, info))
|
||||
if (!gst_rtp_jpeg_pay_read_sof (pay, data, size, &offset, info, tables,
|
||||
G_N_ELEMENTS (tables)))
|
||||
goto invalid_format;
|
||||
sof_found = TRUE;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue