diff options
author | Andrey Utkin <andrey.krieger.utkin@gmail.com> | 2012-08-14 12:48:45 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-14 16:25:53 +0200 |
commit | aec9390a9d38014615d569ecaf392b22f693e4b6 (patch) | |
tree | 733c8d847d6dab7088844846807156222c89b5b4 /libavformat/utils.c | |
parent | 7427d1ca4ab202def24fc3cefc4401a351d7248c (diff) | |
download | ffmpeg-aec9390a9d38014615d569ecaf392b22f693e4b6.tar.gz |
Check for avio fail in avformat_write_header, av_write_frame
With minor changes by michael
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 8c2849dc21..a522c48f2b 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++; |