From: Sean McGovern <[email protected]>

And forward the error if it is not.

Bug-Id: 881

CC: [email protected]

Signed-off-by: Luca Barbato <[email protected]>
---

You forgot write_trailer, I unified the check in write_packet() that
all the three public functions actually call.

 libavformat/mux.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 7959edf..dc1182c 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -352,8 +352,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
     }
     ret = s->oformat->write_packet(s, pkt);

-    if (s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
-        avio_flush(s->pb);
+    if (s->pb && ret >= 0) {
+        if (s->flags & AVFMT_FLAG_FLUSH_PACKETS)
+            avio_flush(s->pb);
+        if (s->pb->error < 0)
+            ret = s->pb->error;
+    }

     return ret;
 }
@@ -400,6 +404,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)

     if (ret >= 0)
         s->streams[pkt->stream_index]->nb_frames++;
+
     return ret;
 }

--
2.5.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to