summaryrefslogtreecommitdiffstats
path: root/libaf
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-09-17 18:44:20 +0300
committerwm4 <wm4@nowhere>2012-10-28 17:36:28 +0100
commit616047c6186141691e856083683552b94217fbcb (patch)
tree6931570b8c5a916d4f7bc70a2aa7cf68c86fa204 /libaf
parent6903319c6628ebd794c0f817e533276e60a194b3 (diff)
downloadmpv-616047c6186141691e856083683552b94217fbcb.tar.bz2
mpv-616047c6186141691e856083683552b94217fbcb.tar.xz
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.
Diffstat (limited to 'libaf')
-rw-r--r--libaf/af_scaletempo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libaf/af_scaletempo.c b/libaf/af_scaletempo.c
index 7b951860d4..c0197d5b40 100644
--- a/libaf/af_scaletempo.c
+++ b/libaf/af_scaletempo.c
@@ -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) {