On Thu, Aug 11, 2016 at 02:38:29PM +0200, sebechlebsky...@gmail.com wrote: > From: Jan Sebechlebsky <sebechlebsky...@gmail.com> > > This makes av_write_trailer not to free the resources if write_trailer > call returns AVERROR(EAGAIN) allowing repeated calls of write_trailer of > non-blocking muxer. > > Signed-off-by: Jan Sebechlebsky <sebechlebsky...@gmail.com> > --- > Changes since the last version of the patch: > - Added assert to the part of the code dealing with flushing > interleaved packets which should not be entered if > muxer in non-blocking mode is used. > (also there is assert for the same condition added into > av_interleaved_write_packet in one of the following > patches). > > libavformat/avformat.h | 6 +++++- > libavformat/mux.c | 10 ++++++++-- > 2 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > index d8a6cf3..2cc3156 100644 > --- a/libavformat/avformat.h > +++ b/libavformat/avformat.h > @@ -2510,8 +2510,12 @@ int av_write_uncoded_frame_query(AVFormatContext *s, > int stream_index); > * > * May only be called after a successful call to avformat_write_header. > * > + * If AVFMT_FLAG_NONBLOCK is set, this call may return AVERROR(EAGAIN) > + * meaning the operation is pending and the call should be repeated. > + * > * @param s media file handle > - * @return 0 if OK, AVERROR_xxx on error > + * @return 0 if OK, AVERROR(EAGAIN) in case call should be repeated, > + * other AVERROR on error > */ > int av_write_trailer(AVFormatContext *s); > > diff --git a/libavformat/mux.c b/libavformat/mux.c > index e9973ed..3ae924c 100644 > --- a/libavformat/mux.c > +++ b/libavformat/mux.c > @@ -1204,11 +1204,14 @@ int av_write_trailer(AVFormatContext *s) > for (;; ) { > AVPacket pkt; > ret = interleave_packet(s, &pkt, NULL, 1); > - if (ret < 0) > - goto fail; > if (!ret) > break; > > + av_assert0(!(s->flags & AVFMT_FLAG_NONBLOCK));
this would abort on any error not just EAGAIN [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel