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).
This commit is contained in:
1 parent
66aa54d319
commit
0a41c6f0ec
2 files changed
+11
-2
No files matched your search
@@ -30,7 +30,7 @@ struct dec_audio {
|
||||
struct mp_log *log;
|
||||
struct MPOpts *opts;
|
||||
struct mpv_global *global;
|
||||
bool spdif_passthrough;
|
||||
bool spdif_passthrough, spdif_failed;
|
||||
const struct ad_functions *ad_driver;
|
||||
struct sh_stream *header;
|
||||
struct af_stream *afilter;
|
||||
|
||||
+10
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user