summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_scaletempo2_internals.h
diff options
context:
space:
mode:
authorferreum <code@ferreum.de>2023-08-17 17:11:25 +0200
committerNiklas Haas <github-daiK1o@haasn.dev>2023-09-20 14:36:23 +0200
commitcf8b7ff0d666a4c13b32d8d9e973435df419b5ef (patch)
treed4685cb8588913559fa082d216a86021a0e2d9aa /audio/filter/af_scaletempo2_internals.h
parentc0728249a18f5e7ec40332e002f4cd9fedc8e91c (diff)
downloadmpv-cf8b7ff0d666a4c13b32d8d9e973435df419b5ef.tar.bz2
mpv-cf8b7ff0d666a4c13b32d8d9e973435df419b5ef.tar.xz
af_scaletempo2: calculate latency by center of search block
This changes the emitted pts values from the start of the search block to the center of the search block. Change initial `output_time` accordingly. Initial `search_block_index` is irrelevant, because it's overwritten before the first iteration. Using the `output_time` removes the rounding of `search_block_index`, which also fixes the <20 microsecond gaps in timestamps between output packets. Rationale: The variance in audio position was in the range `0..search-interval`. With this change, the range is (- search-interval / 2)..(search-interval / 2)` which ensures lower maximum offset.
Diffstat (limited to 'audio/filter/af_scaletempo2_internals.h')
-rw-r--r--audio/filter/af_scaletempo2_internals.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/audio/filter/af_scaletempo2_internals.h b/audio/filter/af_scaletempo2_internals.h
index f1b74ec64f..622d6e20da 100644
--- a/audio/filter/af_scaletempo2_internals.h
+++ b/audio/filter/af_scaletempo2_internals.h
@@ -64,7 +64,8 @@ struct mp_scaletempo2 {
double output_time;
// The offset of the center frame of |search_block| w.r.t. its first frame.
int search_block_center_offset;
- // Index of the beginning of the |search_block|, in frames.
+ // Index of the beginning of the |search_block|, in frames. This may be
+ // negative, which is handled by |peek_audio_with_zero_prepend|.
int search_block_index;
// Number of Blocks to search to find the most similar one to the target
// frame.