X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Futils.c;h=f7adb525f8bbde87afa93ce7a7c66610c5ba792a;hb=c9ee36e60ffb2986acf7decacf6ef6e1da657d61;hp=54a3e8708d3aa3f76b5e9901829f75de88d99514;hpb=3801060cd028cc11cd4000eae8e578a715051310;p=ffmpeg diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 54a3e8708d3..f7adb525f8b 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1412,6 +1412,13 @@ FF_DISABLE_DEPRECATION_WARNINGS } FF_ENABLE_DEPRECATION_WARNINGS #endif + + if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) { + av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n"); + ret = AVERROR(EINVAL); + goto free_and_end; + } + if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i])