FFmpeg: Disallow recording video with no audio nor video

This commit is contained in:
Vicki Pfau 2020-02-02 16:46:11 -08:00
parent 74981b1d36
commit d03a4f0836
2 changed files with 2 additions and 1 deletions

View File

@ -11,6 +11,7 @@ Other fixes:
- Core: Fix race condition initializing thread proxy
- Core: Fix integer overflow in ELF loading
- FFmpeg: Fix crash when -strict -2 is needed for vcodec or container
- FFmpeg: Disallow recording video with no audio nor video
- Qt: Only dynamically reset video scale if a game is running
- Qt: Fix race condition with proxied video events
- Qt: Fix color selection in asset view (fixes mgba.io/i/1648)

View File

@ -232,7 +232,7 @@ bool FFmpegEncoderVerifyContainer(struct FFmpegEncoder* encoder) {
AVOutputFormat* oformat = av_guess_format(encoder->containerFormat, 0, 0);
AVCodec* acodec = avcodec_find_encoder_by_name(encoder->audioCodec);
AVCodec* vcodec = avcodec_find_encoder_by_name(encoder->videoCodec);
if ((encoder->audioCodec && !acodec) || (encoder->videoCodec && !vcodec) || !oformat) {
if ((encoder->audioCodec && !acodec) || (encoder->videoCodec && !vcodec) || !oformat || (!acodec && !vcodec)) {
return false;
}
if (encoder->audioCodec && !avformat_query_codec(oformat, acodec->id, FF_COMPLIANCE_EXPERIMENTAL)) {