FFmpeg: Return false if a file fails to open
Vicki Pfau vi@endrift.com
Tue, 04 Apr 2017 02:01:06 -0700
2 files changed,
4 insertions(+),
1 deletions(-)
M
src/feature/ffmpeg/ffmpeg-encoder.c
→
src/feature/ffmpeg/ffmpeg-encoder.c
@@ -320,7 +320,9 @@ #ifdef FFMPEG_USE_CODECPAR
avcodec_parameters_from_context(encoder->videoStream->codecpar, encoder->video); #endif - avio_open(&encoder->context->pb, outfile, AVIO_FLAG_WRITE); + if (avio_open(&encoder->context->pb, outfile, AVIO_FLAG_WRITE) < 0) { + return false; + } return avformat_write_header(encoder->context, 0) >= 0; }