[FFmpeg-cvslog] avformat/aviobuf: return stored AVIO context error on avio_close
Marton Balint
git at videolan.org
Sun Dec 12 01:39:52 EET 2021
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Tue Nov 30 00:59:14 2021 +0100| [8a40cfa4dab461643f4f93f3340c897d708ea221] | committer: Marton Balint
avformat/aviobuf: return stored AVIO context error on avio_close
Otherwise IO errors at avio_flush() before closing may be lost.
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a40cfa4dab461643f4f93f3340c897d708ea221
---
libavformat/aviobuf.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 14688a2262..969c127b23 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1231,6 +1231,7 @@ int avio_close(AVIOContext *s)
{
FFIOContext *const ctx = ffiocontext(s);
URLContext *h;
+ int ret, error;
if (!s)
return 0;
@@ -1249,9 +1250,14 @@ int avio_close(AVIOContext *s)
ctx->bytes_read, ctx->seek_count);
av_opt_free(s);
+ error = s->error;
avio_context_free(&s);
- return ffurl_close(h);
+ ret = ffurl_close(h);
+ if (ret < 0)
+ return ret;
+
+ return error;
}
int avio_closep(AVIOContext **s)
More information about the ffmpeg-cvslog
mailing list