From e2ce16392205d8efe9143329ed3fb5fcb15498fa Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Fri, 19 Dec 2014 15:23:06 +0200 Subject: mpegts: Support running the write_trailer function without an AVIOContext MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If opening and closing dynamic buffers as AVIOContext, we may not have any AVIOContext available when wanting to close and deallocate the muxer. Allow calling write_trailer despite this. Signed-off-by: Martin Storsjö --- libavformat/mpegtsenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libavformat/mpegtsenc.c') diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 8fa1c3e370..1be4e55683 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1192,7 +1192,8 @@ static int mpegts_write_end(AVFormatContext *s) MpegTSService *service; int i; - mpegts_write_flush(s); + if (s->pb) + mpegts_write_flush(s); for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; -- cgit v1.2.3