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:
wm4 2016-01-25 13:43:43 +01:00
parent 223588b36a
commit 266d8368e8
1 changed files with 2 additions and 0 deletions

View File

@ -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;
} }