summaryrefslogtreecommitdiffstats
path: root/libaf/af.c
diff options
context:
space:
mode:
authoruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-01 06:52:50 +0000
committeruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-01 06:52:50 +0000
commitd7f6cb23dec483f538239eb42e21c321713c976e (patch)
treea5a87950b4cdae8d0b4e9a6df202000fd4825615 /libaf/af.c
parentde034ce87fdf632b48563e5764f19d66120550a8 (diff)
downloadmpv-d7f6cb23dec483f538239eb42e21c321713c976e.tar.bz2
mpv-d7f6cb23dec483f538239eb42e21c321713c976e.tar.xz
A/V sync: take audio filter buffers into account
Substract the delay caused by filter buffering when calculating currently playing audio position. This matters for af_scaletempo which buffers significant and varying amounts of data. For other current filters the effect is normally insignificant. Instead of the old time-based filter delay field (which was ignored) this version stores the per-filter delay in units of bytes input read without corresponding output. This allows the current scaletempo behavior where other filters before and after it can see the same nominal samplerate even though the real duration of the data varies; in this case the other filters can not know the delay they're causing in terms of real time. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24928 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf/af.c')
-rw-r--r--libaf/af.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libaf/af.c b/libaf/af.c
index 32c59dbbcd..c229f9eee6 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -542,7 +542,7 @@ double af_calc_filter_multiplier(af_stream_t* s)
return mul;
}
-/* Calculate the total delay [ms] caused by the filters */
+/* Calculate the total delay [bytes output] caused by the filters */
double af_calc_delay(af_stream_t* s)
{
af_instance_t* af=s->first;
@@ -550,6 +550,7 @@ double af_calc_delay(af_stream_t* s)
// Iterate through all filters
while(af){
delay += af->delay;
+ delay *= af->mul;
af=af->next;
}
return delay;