mirror of https://github.com/mpv-player/mpv
audio: fix spdif PCM fallback
With the format left untouched, this would just try to reinit with a spdif format again. We're not clearing the format in reset_audio_state() so the audio chain can be recreated any time without having to wait for a frame to be decoded.
This commit is contained in:
parent
223588b36a
commit
266d8368e8
|
@ -346,12 +346,14 @@ void reinit_audio_chain(struct MPContext *mpctx)
|
||||||
if (!mpctx->ao) {
|
if (!mpctx->ao) {
|
||||||
// If spdif was used, try to fallback to PCM.
|
// If spdif was used, try to fallback to PCM.
|
||||||
if (spdif_fallback) {
|
if (spdif_fallback) {
|
||||||
|
MP_VERBOSE(mpctx, "Falling back to PCM output.\n");
|
||||||
ao_c->spdif_passthrough = false;
|
ao_c->spdif_passthrough = false;
|
||||||
ao_c->spdif_failed = true;
|
ao_c->spdif_failed = true;
|
||||||
ao_c->audio_src->try_spdif = false;
|
ao_c->audio_src->try_spdif = false;
|
||||||
if (!audio_init_best_codec(ao_c->audio_src))
|
if (!audio_init_best_codec(ao_c->audio_src))
|
||||||
goto init_error;
|
goto init_error;
|
||||||
reset_audio_state(mpctx);
|
reset_audio_state(mpctx);
|
||||||
|
ao_c->input_format = (struct mp_audio){0};
|
||||||
reinit_audio_chain(mpctx);
|
reinit_audio_chain(mpctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue