summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-06 20:17:49 +0200
committerwm4 <wm4@nowhere>2015-10-06 20:21:29 +0200
commit0a41c6f0ec1adeb4e627daeddb474c0c9bdad008 (patch)
tree3b3375c2f57651beac2d02aea70e6325bffae2ac /player
parent66aa54d319755589e846efe53f917d2667219e1a (diff)
downloadmpv-0a41c6f0ec1adeb4e627daeddb474c0c9bdad008.tar.bz2
mpv-0a41c6f0ec1adeb4e627daeddb474c0c9bdad008.tar.xz
audio: make spdif re-probe from normal decoding work
The previous commit handled not falling back to normal decoding if the AO was reloaded (I think...), and this tries to re-engage spdif pass- through if it was previously falling back to normal decoding (e.g. because it temporarily switched to an audio device incapable of passthrough).
Diffstat (limited to 'player')
-rw-r--r--player/audio.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/player/audio.c b/player/audio.c
index 9ff253ae92..0b35d7018b 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -289,6 +289,7 @@ void reinit_audio_chain(struct MPContext *mpctx)
// If spdif was used, try to fallback to PCM.
if (spdif_fallback) {
mpctx->d_audio->spdif_passthrough = false;
+ mpctx->d_audio->spdif_failed = true;
if (!audio_init_best_codec(mpctx->d_audio))
goto init_error;
reset_audio_state(mpctx);
@@ -474,7 +475,15 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
ao_reset(mpctx->ao);
uninit_audio_out(mpctx);
if (d_audio) {
- mpctx->d_audio->spdif_passthrough = true;
+ if (mpctx->d_audio->spdif_failed) {
+ mpctx->d_audio->spdif_failed = false;
+ mpctx->d_audio->spdif_passthrough = true;
+ if (!audio_init_best_codec(mpctx->d_audio)) {
+ MP_ERR(mpctx, "Error reinitializing audio.\n");
+ error_on_track(mpctx, mpctx->current_track[0][STREAM_AUDIO]);
+ return;
+ }
+ }
mpctx->audio_status = STATUS_SYNCING;
}
}