X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmux.c;h=37b597646445db0541cc7f6b85ebc39e51bdc5cd;hb=f6e598afa8229d25bc8b84c954282d74147d6265;hp=f2c137fa9e5f17063f7752a5b1ff578ff0372b20;hpb=7f6b794da051ff4e4235bbc2b84469ff2807a453;p=ffmpeg diff --git a/libavformat/mux.c b/libavformat/mux.c index f2c137fa9e5..37b59764644 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -660,8 +660,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) ret = s->oformat->write_packet(s, pkt); } - if (s->flush_packets && s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS) - avio_flush(s->pb); + if (s->pb && ret >= 0) { + if (s->flush_packets && s->flags & AVFMT_FLAG_FLUSH_PACKETS) + avio_flush(s->pb); + if (s->pb->error < 0) + ret = s->pb->error; + } + if (did_split) av_packet_merge_side_data(pkt);