diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-08 11:24:09 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-10-08 16:03:21 +0200 |
commit | 21914e7a4e802772cc9cdeec3eec8b30da4fa95a (patch) | |
tree | 38ffe4795ae194373afad3ce8f1acfa5a10e3680 /fftools/ffmpeg_opt.c | |
parent | f1df856fb632c2d14a29cfb1f4a11c4dbb027f89 (diff) | |
download | ffmpeg-21914e7a4e802772cc9cdeec3eec8b30da4fa95a.tar.gz |
fftools/ffmpeg, ffmpeg_opt: Allocate (In|Out)putStream.pkt early
Avoids checks lateron in the hot path.
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools/ffmpeg_opt.c')
-rw-r--r-- | fftools/ffmpeg_opt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index c46a9343e1..7aff43d917 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -888,6 +888,10 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) exit_program(1); } + ist->pkt = av_packet_alloc(); + if (!ist->pkt) + exit_program(1); + if (o->bitexact) ist->dec_ctx->flags |= AV_CODEC_FLAG_BITEXACT; @@ -1516,6 +1520,10 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e exit_program(1); } + ost->pkt = av_packet_alloc(); + if (!ost->pkt) + exit_program(1); + if (ost->enc) { AVIOContext *s = NULL; char *buf = NULL, *arg = NULL, *preset = NULL; |