mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
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>
This commit is contained in:
parent
868ac91c8d
commit
f9eed5d7e6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user