summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2016-06-22 19:29:56 +0200
committerClément Bœsch <u@pkh.me>2016-06-22 19:29:56 +0200
commitd4b1b3b06c210be9088eb0940acca0a914b6b916 (patch)
treea6b1d972885834938ec05e14aa4cc30eacb1bb26 /libavcodec/utils.c
parent70d48accd8558f4b7386df369290a3ec85cd1537 (diff)
parente62ff72fc1052273deb708ba715f73e5187281d4 (diff)
Merge commit 'e62ff72fc1052273deb708ba715f73e5187281d4'
* commit 'e62ff72fc1052273deb708ba715f73e5187281d4': lavc: make avcodec_open2() fail when the timebase is not set for encoding Merged-by: Clément Bœsch <u@pkh.me>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 54a3e8708d..f7adb525f8 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])