From fc308b30bb24e623fed042ec78b10803b2362a18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Fri, 19 Dec 2014 15:26:23 +0200
Subject: [PATCH] rtpenc_mpegts: Call write_trailer for the mpegts muxer even
 if no output buffer exists
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since the mpegts muxer now can handle being called with a NULL
AVIOContext, we don't need to try to allocate one before calling
write_trailer.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavformat/rtpenc_mpegts.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c
index 4e243f0bd84..f170f979349 100644
--- a/libavformat/rtpenc_mpegts.c
+++ b/libavformat/rtpenc_mpegts.c
@@ -32,11 +32,9 @@ static int rtp_mpegts_write_close(AVFormatContext *s)
     struct MuxChain *chain = s->priv_data;
 
     if (chain->mpegts_ctx) {
-        if (!chain->mpegts_ctx->pb)
-            avio_open_dyn_buf(&chain->mpegts_ctx->pb);
+        av_write_trailer(chain->mpegts_ctx);
         if (chain->mpegts_ctx->pb) {
             uint8_t *buf;
-            av_write_trailer(chain->mpegts_ctx);
             avio_close_dyn_buf(chain->mpegts_ctx->pb, &buf);
             av_free(buf);
         }
-- 
GitLab