Module: Mesa
Branch: main
Commit: 15a2b1797b74c9a3d32c3663d7a5384ecedc163c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=15a2b1797b74c9a3d32c3663d7a5384ecedc163c

Author: Honglei Huang <[email protected]>
Date:   Thu Jan 12 16:14:01 2023 +0800

virgl/video: Add jpeg buf start code check

Add jpeg start code check to fix the issue that
double header adding in virgl video codec.

Signed-off-by: Honglei Huang <[email protected]>
Reviewed-by: Leo Liu <[email protected]>
Reviewed-by: Boyuan Zhang <[email protected]>
Reviewed-by: Daniel Almeida <[email protected]>
Reviewed-by: Feng Jiang <[email protected]>
Signed-off-by: Huang Rui <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22108>

---

 src/gallium/frontends/va/picture.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/frontends/va/picture.c 
b/src/gallium/frontends/va/picture.c
index ec81ed3f33f..cd92465bdec 100644
--- a/src/gallium/frontends/va/picture.c
+++ b/src/gallium/frontends/va/picture.c
@@ -389,6 +389,9 @@ handleVASliceDataBufferType(vlVaContext *context, 
vlVaBuffer *buf)
          sizes[num_buffers++] = context->mpeg4.start_code_size;
          break;
       case PIPE_VIDEO_FORMAT_JPEG:
+         if (bufHasStartcode(buf, 0xffd8ffdb, 32))
+            break;
+
          vlVaGetJpegSliceHeader(context);
          buffers[num_buffers] = (void *)context->mjpeg.slice_header;
          sizes[num_buffers++] = context->mjpeg.slice_header_size;

Reply via email to