[FFmpeg-devel] [PATCH] avcodec/cavs_parser: fix finding the end of a frame

Zhao Zhili quinkblack at foxmail.com
Mon May 15 14:49:30 EEST 2023


From: Zhao Zhili <zhilizhao at tencent.com>

Use the next I/P/B or start code as the end of current frame.

Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
---
 libavcodec/cavs_parser.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index 03f392c2e5..4a03effd0f 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -59,12 +59,11 @@ static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf,
             return 0;
         for(; i<buf_size; i++){
             state= (state<<8) | buf[i];
-            if((state&0xFFFFFF00) == 0x100){
-                if(state > SLICE_MAX_START_CODE){
-                    pc->frame_start_found=0;
-                    pc->state=-1;
-                    return i-3;
-                }
+            if (state == PIC_I_START_CODE || state == PIC_PB_START_CODE ||
+                    state == CAVS_START_CODE) {
+                pc->frame_start_found=0;
+                pc->state=-1;
+                return i-3;
             }
         }
     }
-- 
2.25.1



More information about the ffmpeg-devel mailing list