mirror of https://github.com/mpv-player/mpv
audio: refuse to change playback speed with spdif
Handle the failure gracefully, instead of exploding and disabling audio. Just set the speed back to 1.0. Also remove the AF_DETACH from af_scaletempo. This actually created a dangling pointer in af_add(), a tricky consequence of af_add() reconfiguring the filter chain and the newly added filter using AF_DETACH. Fortunately the AF_DETACH is not needed (and probably never worked - it comes from MPlayer times, and MPlayer also disables audio when trying to change speed with spdif).
This commit is contained in:
parent
b2099f55d2
commit
89db92398e
|
@ -305,7 +305,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
|
||||
if (AF_FORMAT_IS_SPECIAL(data->format)) {
|
||||
MP_ERR(af, "Changing speed is not supported with spdif formats.\n");
|
||||
return AF_DETACH;
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
mp_audio_force_interleaved_format(data);
|
||||
|
|
|
@ -104,8 +104,10 @@ static int recreate_audio_filters(struct MPContext *mpctx)
|
|||
{
|
||||
assert(mpctx->d_audio);
|
||||
|
||||
if (update_playback_speed_filters(mpctx) < 0)
|
||||
return -1;
|
||||
if (update_playback_speed_filters(mpctx) < 0) {
|
||||
mpctx->opts->playback_speed = 1.0;
|
||||
mp_notify(mpctx, MP_EVENT_CHANGE_ALL, NULL);
|
||||
}
|
||||
|
||||
struct af_stream *afs = mpctx->d_audio->afilter;
|
||||
if (afs->initialized < 1 && af_init(afs) < 0) {
|
||||
|
|
Loading…
Reference in New Issue