rtpjpegdepay: fix logic error when checking if an EOI is present
authorTim-Philipp Müller <tim@centricular.com>
Thu, 23 Mar 2023 16:40:54 +0000 (16:40 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 25 Mar 2023 01:00:36 +0000 (01:00 +0000)
We wouldn't add the missing EOI marker if the frame ended with
either 0xFF NN or 0xNN D9.

Fixes #2407

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4269>

subprojects/gst-plugins-good/gst/rtp/gstrtpjpegdepay.c

index 02209d5..b85b7fb 100644 (file)
@@ -705,7 +705,7 @@ gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
      * marker */
     gst_adapter_copy (rtpjpegdepay->adapter, end, avail - 2, 2);
 
-    if (end[0] != 0xff && end[1] != 0xd9) {
+    if (GST_READ_UINT16_BE (end) != 0xffd9) {
       GST_DEBUG_OBJECT (rtpjpegdepay, "no EOI marker, adding one");
 
       /* no EOI marker, add one */