Commit 4903662a authored by kjeyapal@akamai.com's avatar kjeyapal@akamai.com Committed by Karthick J

avformat/dashenc : Handled error from ff_http_do_new_request() cleanly

parent 3913d6f7
......@@ -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,6 +361,7 @@ 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;
if (os->out)
avio_write(os->out, buffer + os->written_len, *range_length - os->written_len);
os->written_len = 0;
av_free(buffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment