]> git.sesse.net Git - nageru/commitdiff
Don't call avio_closep() unless we actually have an output file (e.g. in the stream...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 26 Sep 2016 23:04:44 +0000 (01:04 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 26 Sep 2016 23:05:02 +0000 (01:05 +0200)
mux.cpp

diff --git a/mux.cpp b/mux.cpp
index 2947cac82ab519bdddb22e9bab1862805f80658e..df974f0644520aa7c31ffb757abe1b733af2e480 100644 (file)
--- a/mux.cpp
+++ b/mux.cpp
@@ -94,7 +94,10 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const
 Mux::~Mux()
 {
        av_write_trailer(avctx);
-       avio_closep(&avctx->pb);
+       if (!(avctx->oformat->flags & AVFMT_NOFILE) &&
+           !(avctx->flags & AVFMT_FLAG_CUSTOM_IO)) {
+               avio_closep(&avctx->pb);
+       }
        avformat_free_context(avctx);
 }