[FFmpeg-devel] [PATCH] lavfi/atempo: fix range check if tempo is set by command

wbsecg1 at gmail.com wbsecg1 at gmail.com
Wed Oct 3 18:01:44 EEST 2018


From: wang-bin <wbsecg1 at gmail.com>

---
 libavfilter/af_atempo.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 52f15f2769..1a004212a7 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -331,9 +331,10 @@ static int yae_set_tempo(AVFilterContext *ctx, const char *arg_tempo)
         return AVERROR(EINVAL);
     }
 
-    if (tempo < 0.5 || tempo > 2.0) {
-        av_log(ctx, AV_LOG_ERROR, "Tempo value %f exceeds [0.5, 2.0] range\n",
-               tempo);
+    const AVOption *o = av_opt_find(&atempo->class, "tempo", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ);
+    if (tempo < o->min || tempo > o->max) {
+        av_log(ctx, AV_LOG_ERROR, "Tempo value %f exceeds [%.1f, %.1f] range\n",
+               tempo, o->min, o->max);
         return AVERROR(EINVAL);
     }
 
@@ -439,8 +440,8 @@ static int yae_load_data(ATempoContext *atempo,
         return 0;
     }
 
-    // samples are not expected to be skipped, unless tempo is greater than 2:
-    av_assert0(read_size <= atempo->ring || atempo->tempo > 2.0);
+    // samples are not expected to be skipped:
+    av_assert0(read_size <= atempo->ring);
 
     while (atempo->position[0] < stop_here && src < src_end) {
         int src_samples = (src_end - src) / atempo->stride;
-- 
2.17.1 (Apple Git-112)



More information about the ffmpeg-devel mailing list