Message ID | tencent_E6F59C4CE1B25B063533805C35A53F235709@qq.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] avcodec/cavs_parser: fix finding the end of a frame | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
Quoting Zhao Zhili (2023-05-15 13:49:30) > From: Zhao Zhili <zhilizhao@tencent.com> > > Use the next I/P/B or start code as the end of current frame. > > Signed-off-by: Zhao Zhili <zhilizhao@tencent.com> > --- > libavcodec/cavs_parser.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) Do you have a test case? Would be nice to make it into a FATE test.
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; } } }