summaryrefslogtreecommitdiff
path: root/fftools
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-10-08 09:47:33 +0200
committerJames Almer <jamrial@gmail.com>2021-10-08 11:31:37 -0300
commit4b583e54253746e82850f5a24999affe2d7e2558 (patch)
treeb9d936f24da4144ed05c44dfc261a26b790037db /fftools
parentc989427c168b95997ef7366a6cef98f4b40acc66 (diff)
downloadffmpeg-4b583e54253746e82850f5a24999affe2d7e2558.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> (cherry picked from commit fb215798c7a72b32e889b72efd018f26bb3f88ce)
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 9a34d1f13e..dec012a299 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1974,6 +1974,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";