mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
9be2f6b9f8
commit
ae448e198f
|
@ -62,15 +62,9 @@ static int build_afilter_chain(struct MPContext *mpctx)
|
||||||
new_srate = in_format.rate;
|
new_srate = in_format.rate;
|
||||||
else {
|
else {
|
||||||
new_srate = in_format.rate * opts->playback_speed;
|
new_srate = in_format.rate * opts->playback_speed;
|
||||||
if (new_srate != out_format.rate) {
|
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;
|
|
||||||
opts->playback_speed = new_srate / (double)in_format.rate;
|
opts->playback_speed = new_srate / (double)in_format.rate;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return audio_init_filters(d_audio, new_srate,
|
return audio_init_filters(d_audio, new_srate,
|
||||||
&out_format.rate, &out_format.channels, &out_format.format);
|
&out_format.rate, &out_format.channels, &out_format.format);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue