mpegts: Support running the write_trailer function without an AVIOContext
authorMartin Storsjö <martin@martin.st>
Fri, 19 Dec 2014 13:23:06 +0000 (15:23 +0200)
committerMartin Storsjö <martin@martin.st>
Fri, 19 Dec 2014 21:13:04 +0000 (23:13 +0200)
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ö <martin@martin.st>
libavformat/mpegtsenc.c

index 8fa1c3e..1be4e55 100644 (file)
@@ -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];