Commit f289a6b7 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

avformat/webm_chunk: Check unchecked functions for errors

Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent d624fb5d
...@@ -95,7 +95,8 @@ static int webm_chunk_init(AVFormatContext *s) ...@@ -95,7 +95,8 @@ static int webm_chunk_init(AVFormatContext *s)
oc->flush_packets = 0; oc->flush_packets = 0;
av_dict_copy(&oc->metadata, s->metadata, 0); if ((ret = av_dict_copy(&oc->metadata, s->metadata, 0)) < 0)
return ret;
if (!(st = avformat_new_stream(oc, NULL))) if (!(st = avformat_new_stream(oc, NULL)))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
...@@ -109,11 +110,14 @@ static int webm_chunk_init(AVFormatContext *s) ...@@ -109,11 +110,14 @@ static int webm_chunk_init(AVFormatContext *s)
avpriv_set_pts_info(st, ost->pts_wrap_bits, ost->time_base.num, avpriv_set_pts_info(st, ost->pts_wrap_bits, ost->time_base.num,
ost->time_base.den); ost->time_base.den);
av_dict_set_int(&dict, "dash", 1, 0); if ((ret = av_dict_set_int(&dict, "dash", 1, 0)) < 0 ||
av_dict_set_int(&dict, "cluster_time_limit", wc->chunk_duration, 0); (ret = av_dict_set_int(&dict, "cluster_time_limit",
av_dict_set_int(&dict, "live", 1, 0); wc->chunk_duration, 0)) < 0 ||
(ret = av_dict_set_int(&dict, "live", 1, 0)) < 0)
goto fail;
ret = avformat_init_output(oc, &dict); ret = avformat_init_output(oc, &dict);
fail:
av_dict_free(&dict); av_dict_free(&dict);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -155,7 +159,8 @@ static int webm_chunk_write_header(AVFormatContext *s) ...@@ -155,7 +159,8 @@ static int webm_chunk_write_header(AVFormatContext *s)
AVDictionary *options = NULL; AVDictionary *options = NULL;
if (wc->http_method) if (wc->http_method)
av_dict_set(&options, "method", wc->http_method, 0); if ((ret = av_dict_set(&options, "method", wc->http_method, 0)) < 0)
return ret;
ret = s->io_open(s, &oc->pb, oc->url, AVIO_FLAG_WRITE, &options); ret = s->io_open(s, &oc->pb, oc->url, AVIO_FLAG_WRITE, &options);
av_dict_free(&options); av_dict_free(&options);
if (ret < 0) if (ret < 0)
...@@ -205,14 +210,15 @@ static int chunk_end(AVFormatContext *s, int flush) ...@@ -205,14 +210,15 @@ static int chunk_end(AVFormatContext *s, int flush)
if (ret < 0) if (ret < 0)
goto fail; goto fail;
if (wc->http_method) if (wc->http_method)
av_dict_set(&options, "method", wc->http_method, 0); if ((ret = av_dict_set(&options, "method", wc->http_method, 0)) < 0)
goto fail;
ret = s->io_open(s, &pb, filename, AVIO_FLAG_WRITE, &options); ret = s->io_open(s, &pb, filename, AVIO_FLAG_WRITE, &options);
av_dict_free(&options);
if (ret < 0) if (ret < 0)
goto fail; goto fail;
avio_write(pb, buffer, buffer_size); avio_write(pb, buffer, buffer_size);
ff_format_io_close(s, &pb); ff_format_io_close(s, &pb);
fail: fail:
av_dict_free(&options);
av_free(buffer); av_free(buffer);
return (ret < 0) ? ret : 0; return (ret < 0) ? ret : 0;
} }
...@@ -260,7 +266,9 @@ static int webm_chunk_write_trailer(AVFormatContext *s) ...@@ -260,7 +266,9 @@ static int webm_chunk_write_trailer(AVFormatContext *s)
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
av_write_trailer(oc); ret = av_write_trailer(oc);
if (ret < 0)
return ret;
return chunk_end(s, 0); return chunk_end(s, 0);
} }
......
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