summaryrefslogtreecommitdiff
path: root/fftools
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-08 09:47:33 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-08 12:06:00 +0200
commitfb215798c7a72b32e889b72efd018f26bb3f88ce (patch)
tree33d6be929f762e8a9d9af92024d62be9ebae6eb4 /fftools
parent6d72126e9ba857c68f0a363729ad67097355c090 (diff)
downloadffmpeg-fb215798c7a72b32e889b72efd018f26bb3f88ce.tar.gz
fftools/ffmpeg: Fix crash when flushing non-fully setup output stream
The output stream's packet may not have been allocated at that point. This happens when quitting in the following command line: $ ./ffmpeg -lavfi abuffer=sample_fmt=u8:sample_rate=48000:channel_layout=stereo -f null - Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'fftools')
-rw-r--r--fftools/ffmpeg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index bb29e3cec5..0e38d6d185 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1981,6 +1981,9 @@ static void flush_encoders(void)
AVPacket *pkt = ost->pkt;
int pkt_size;
+ if (!pkt)
+ break;
+
switch (enc->codec_type) {
case AVMEDIA_TYPE_AUDIO:
desc = "audio";