summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2020-05-02 14:10:48 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2020-05-03 17:04:07 +0100
commit422f1e32ead99a758375c713447b341c8ac3b20d (patch)
tree40070303561aa57681322001f1b1a2010d8f2e94 /libavcodec
parent706ed34ce7aca7be4adab69a55dab02f4573591a (diff)
avcodec/librav1e: Require a bitrate to be set when using 2-pass mode
Not requiring this leads to unexpected result, since Rav1e's current two pass API has no way to fail in such a case. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/librav1e.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index b0ff60d8c7..6f9b4cce4c 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -202,6 +202,12 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
});
}
+ if ((avctx->flags & AV_CODEC_FLAG_PASS1 || avctx->flags & AV_CODEC_FLAG_PASS2) && !avctx->bit_rate) {
+ av_log(avctx, AV_LOG_ERROR, "A bitrate must be set to use two pass mode.\n");
+ ret = AVERROR_INVALIDDATA;
+ goto end;
+ }
+
if (avctx->flags & AV_CODEC_FLAG_PASS2) {
if (!avctx->stats_in) {
av_log(avctx, AV_LOG_ERROR, "No stats file provided for second pass.\n");