From 73c332e3e4c3a4bcc6a23528f2ad050a67391e20 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 23 Mar 2018 13:57:32 +0100 Subject: [PATCH] Unref last packet on exit --- app/src/decoder.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/decoder.c b/app/src/decoder.c index 1932875b..68c1c500 100644 --- a/app/src/decoder.c +++ b/app/src/decoder.c @@ -91,7 +91,11 @@ static int run_decoder(void *data) { packet.data = NULL; packet.size = 0; - while (!av_read_frame(format_ctx, &packet) && !avio_ctx->eof_reached) { + while (!av_read_frame(format_ctx, &packet)) { + if (avio_ctx->eof_reached) { + av_packet_unref(&packet); + goto run_quit; + } // the new decoding/encoding API has been introduced by: // #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 0)