Skip to content
Snippets Groups Projects
Commit 62572435 authored by Martin Storsjö's avatar Martin Storsjö
Browse files

rtpenc_chain: Check for errors from ffio_fdopen and ffio_open_dyn_packet_buf

parent f542dedf
No related branches found
No related tags found
No related merge requests found
...@@ -75,16 +75,19 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s, ...@@ -75,16 +75,19 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
avcodec_copy_context(rtpctx->streams[0]->codec, st->codec); avcodec_copy_context(rtpctx->streams[0]->codec, st->codec);
if (handle) { if (handle) {
ffio_fdopen(&rtpctx->pb, handle); ret = ffio_fdopen(&rtpctx->pb, handle);
if (ret < 0)
ffurl_close(handle);
} else } else
ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size); ret = ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size);
ret = avformat_write_header(rtpctx, &opts); if (!ret)
ret = avformat_write_header(rtpctx, &opts);
av_dict_free(&opts); av_dict_free(&opts);
if (ret) { if (ret) {
if (handle) { if (handle && rtpctx->pb) {
avio_close(rtpctx->pb); avio_close(rtpctx->pb);
} else { } else if (rtpctx->pb) {
uint8_t *ptr; uint8_t *ptr;
avio_close_dyn_buf(rtpctx->pb, &ptr); avio_close_dyn_buf(rtpctx->pb, &ptr);
av_free(ptr); av_free(ptr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment