[FFmpeg-cvslog] Check for avio fail in avformat_write_header, av_write_frame

Andrey Utkin git at videolan.org
Tue Aug 14 16:27:13 CEST 2012


ffmpeg | branch: master | Andrey Utkin <andrey.krieger.utkin at gmail.com> | Tue Aug 14 12:48:45 2012 +0300| [aec9390a9d38014615d569ecaf392b22f693e4b6] | committer: Michael Niedermayer

Check for avio fail in avformat_write_header, av_write_frame

With minor changes by michael
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aec9390a9d38014615d569ecaf392b22f693e4b6
---

 libavformat/utils.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8c2849d..a522c48 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3379,6 +3379,8 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
 
     if(s->oformat->write_header){
         ret = s->oformat->write_header(s);
+        if (ret >= 0 && s->pb && s->pb->error < 0)
+            ret = s->pb->error;
         if (ret < 0)
             goto fail;
     }
@@ -3503,8 +3505,12 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
     int ret;
 
     if (!pkt) {
-        if (s->oformat->flags & AVFMT_ALLOW_FLUSH)
-            return s->oformat->write_packet(s, pkt);
+        if (s->oformat->flags & AVFMT_ALLOW_FLUSH) {
+            ret = s->oformat->write_packet(s, pkt);
+            if (ret >= 0 && s->pb && s->pb->error < 0)
+                ret = s->pb->error;
+            return ret;
+        }
         return 1;
     }
 
@@ -3514,6 +3520,8 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
         return ret;
 
     ret= s->oformat->write_packet(s, pkt);
+    if (ret >= 0 && s->pb && s->pb->error < 0)
+        ret = s->pb->error;
 
     if (ret >= 0)
         s->streams[pkt->stream_index]->nb_frames++;



More information about the ffmpeg-cvslog mailing list