diff mbox series

[FFmpeg-devel,3/5] avcodec/aac_ac3_parser: don't try to sync when the parser is configured to handle complete frames

Message ID 20221022210226.2200-3-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/5,v2] avcodec/ac3dec: split off code discarding garbage at the beginning of a packet | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

James Almer Oct. 22, 2022, 9:02 p.m. UTC
Should speed up parsing when the frames come from non raw containers.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/aac_ac3_parser.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Niedermayer Oct. 24, 2022, 9:49 p.m. UTC | #1
On Sat, Oct 22, 2022 at 06:02:24PM -0300, James Almer wrote:
> Should speed up parsing when the frames come from non raw containers.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/aac_ac3_parser.c | 4 ++++
>  1 file changed, 4 insertions(+)

produces bad timestamps in
./ffmpeg -i ~/tickets/2508/S09E01.\ Smallville\ -\ Savior\ -\ no\ audio\ sample.mkv -t 1 -bitexact -vn -f framecrc -
link to sample is in ticket

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index 6df064e28d..bfbb55d68e 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -40,6 +40,9 @@  int ff_aac_ac3_parse(AVCodecParserContext *s1,
     int new_frame_start;
     int got_frame = 0;
 
+    if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) {
+        i = buf_size;
+    } else {
 get_next:
     i=END_NOT_FOUND;
     if(s->remaining_size <= buf_size){
@@ -77,6 +80,7 @@  get_next:
         *poutbuf_size = 0;
         return buf_size;
     }
+    }
 
     *poutbuf = buf;
     *poutbuf_size = buf_size;