From ae448e198fab311747104474e38a4fbab4e44a06 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 30 Mar 2014 07:34:43 +0200 Subject: [PATCH] audio: remove sample rate limit checks This played the file at a wrong sample rate if the rate was out of certain bounds. A comment says this was for the sake of libaf/af_resample.c. This resampler has been long removed. Our current resampler (libav/swresample) checks supported sample rates on reconfiguration, and will error out if a sample rate is not supported. And I think that is the correct behavior. --- player/audio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/player/audio.c b/player/audio.c index e7c2b8baf4..65c4ad74dd 100644 --- a/player/audio.c +++ b/player/audio.c @@ -62,14 +62,8 @@ static int build_afilter_chain(struct MPContext *mpctx) new_srate = in_format.rate; else { new_srate = in_format.rate * opts->playback_speed; - if (new_srate != out_format.rate) { - // limits are taken from libaf/af_resample.c - if (new_srate < 8000) - new_srate = 8000; - if (new_srate > 192000) - new_srate = 192000; + if (new_srate != out_format.rate) opts->playback_speed = new_srate / (double)in_format.rate; - } } return audio_init_filters(d_audio, new_srate, &out_format.rate, &out_format.channels, &out_format.format);