af_scaletempo: reset latency info when reconfiguring

af_scaletempo kept outdated values in the af->delay field after
reconfiguration until some audio was fed through the filter. This
could affect audio sync code after a playback speed change.
Additionally, in the special case speed=1 the code did not set the
af->mul field at all. Initialize both fields after reconfiguration.
This commit is contained in:
Uoti Urpala 2012-09-17 18:44:20 +03:00 committed by wm4
parent 6903319c66
commit 616047c618
1 changed files with 3 additions and 0 deletions

View File

@ -306,6 +306,8 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
if (s->speed_tempo && s->speed_pitch)
return AF_DETACH;
memcpy(af->data, data, sizeof(af_data_t));
af->delay = 0;
af->mul = 1;
return af_test_output(af, data);
}
@ -327,6 +329,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
s->frames_stride_scaled = s->scale * frames_stride;
s->frames_stride_error = 0;
af->mul = (double)s->bytes_stride / s->bytes_stride_scaled;
af->delay = 0;
frames_overlap = frames_stride * s->percent_overlap;
if (frames_overlap <= 0) {