[vlc-commits] aout: use float rate for resampling
Rémi Denis-Courmont
git at videolan.org
Fri May 4 17:28:20 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May 4 18:12:39 2018 +0300| [28e54db7c089a77c4c0f6108db73adb74655bcf2] | committer: Rémi Denis-Courmont
aout: use float rate for resampling
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28e54db7c089a77c4c0f6108db73adb74655bcf2
---
src/audio_output/dec.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index d395f8a9ec..f1a8fc3b86 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -225,10 +225,10 @@ static void aout_DecSilence (audio_output_t *aout, mtime_t length, mtime_t pts)
aout_OutputPlay (aout, block);
}
-static void aout_DecSynchronize (audio_output_t *aout, mtime_t dec_pts,
- int input_rate)
+static void aout_DecSynchronize(audio_output_t *aout, mtime_t dec_pts)
{
aout_owner_t *owner = aout_owner (aout);
+ const float rate = owner->sync.rate;
mtime_t drift;
/**
@@ -258,7 +258,7 @@ static void aout_DecSynchronize (audio_output_t *aout, mtime_t dec_pts,
* where supported. The other alternative is to flush the buffers
* completely. */
if (drift > (owner->sync.discontinuity ? 0
- : +3 * input_rate * AOUT_MAX_PTS_DELAY / INPUT_RATE_DEFAULT))
+ : lroundf(+3 * AOUT_MAX_PTS_DELAY * rate)))
{
if (!owner->sync.discontinuity)
msg_Warn (aout, "playback way too late (%"PRId64"): "
@@ -281,7 +281,7 @@ static void aout_DecSynchronize (audio_output_t *aout, mtime_t dec_pts,
/* Early audio output.
* This is rare except at startup when the buffers are still empty. */
if (drift < (owner->sync.discontinuity ? 0
- : -3 * input_rate * AOUT_MAX_PTS_ADVANCE / INPUT_RATE_DEFAULT))
+ : lroundf(-3 * AOUT_MAX_PTS_ADVANCE * rate)))
{
if (!owner->sync.discontinuity)
msg_Warn (aout, "playback way too early (%"PRId64"): "
@@ -397,7 +397,7 @@ int aout_DecPlay(audio_output_t *aout, block_t *block)
aout_volume_Amplify (owner->volume, block);
/* Drift correction */
- aout_DecSynchronize (aout, block->i_pts, input_rate);
+ aout_DecSynchronize(aout, block->i_pts);
/* Output */
owner->sync.end = block->i_pts + block->i_length + 1;
More information about the vlc-commits
mailing list