diff options
author | Matthieu Bouron <matthieu.bouron@gmail.com> | 2013-01-12 14:32:03 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-01-12 17:26:35 +0100 |
commit | f9eed5d7e6200a076f2a38c20692d3a002419781 (patch) | |
tree | 7b4e6c7c0ef13c5d5649b0488f98baa7fc681a75 | |
parent | 868ac91c8dbe1df8efa17a141fad0b02a144a7d6 (diff) | |
download | ffmpeg-f9eed5d7e6200a076f2a38c20692d3a002419781.tar.gz |
lavfi/aevalsrc: try to honor specified duration
If nb_samples divide sample_rate and if nb_samples allow it, aevalsrc
should generate the exact amount of samples according to duration.
Example:
aevalsrc=0::n=480:s=48000:d=5.21 should generate 250080 samples.
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
-rw-r--r-- | libavfilter/asrc_aevalsrc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/asrc_aevalsrc.c b/libavfilter/asrc_aevalsrc.c index 3315f1f563..2e5fa98fd7 100644 --- a/libavfilter/asrc_aevalsrc.c +++ b/libavfilter/asrc_aevalsrc.c @@ -214,9 +214,9 @@ static int request_frame(AVFilterLink *outlink) EvalContext *eval = outlink->src->priv; AVFilterBufferRef *samplesref; int i, j; - double t = eval->var_values[VAR_N] * (double)1/eval->sample_rate; + double t = eval->n * (double)1/eval->sample_rate; - if (eval->duration >= 0 && t > eval->duration) + if (eval->duration >= 0 && t >= eval->duration) return AVERROR_EOF; samplesref = ff_get_audio_buffer(outlink, AV_PERM_WRITE, eval->nb_samples); |