[FFmpeg-cvslog] avformat/dashenc : Handled error from ff_http_do_new_request() cleanly
kjeyapal@akamai.com
git at videolan.org
Thu Nov 22 08:36:48 EET 2018
ffmpeg | branch: master | kjeyapal at akamai.com <kjeyapal at akamai.com> | Fri Nov 16 14:45:11 2018 +0530| [4903662a1da95ca8b9b720ae00508e26fbc84f9c] | committer: Karthick J
avformat/dashenc : Handled error from ff_http_do_new_request() cleanly
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4903662a1da95ca8b9b720ae00508e26fbc84f9c
---
libavformat/dashenc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 2c872f93a1..e51ffaf31b 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -174,6 +174,8 @@ static int dashenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename,
URLContext *http_url_context = ffio_geturlcontext(*pb);
av_assert0(http_url_context);
err = ff_http_do_new_request(http_url_context, filename);
+ if (err < 0)
+ ff_format_io_close(s, pb);
#endif
}
return err;
@@ -183,6 +185,9 @@ static void dashenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filenam
DASHContext *c = s->priv_data;
int http_base_proto = filename ? ff_is_http_proto(filename) : 0;
+ if (!*pb)
+ return;
+
if (!http_base_proto || !c->http_persistent) {
ff_format_io_close(s, pb);
#if CONFIG_HTTP_PROTOCOL
@@ -356,7 +361,8 @@ static int flush_dynbuf(OutputStream *os, int *range_length)
// write out to file
*range_length = avio_close_dyn_buf(os->ctx->pb, &buffer);
os->ctx->pb = NULL;
- avio_write(os->out, buffer + os->written_len, *range_length - os->written_len);
+ if (os->out)
+ avio_write(os->out, buffer + os->written_len, *range_length - os->written_len);
os->written_len = 0;
av_free(buffer);
More information about the ffmpeg-cvslog
mailing list