]> git.sesse.net Git - nageru/blobdiff - mux.cpp
Don't call avio_closep() unless we actually have an output file (e.g. in the stream...
[nageru] / 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);
 }