output_all: immediately reopen output on play

When MPD explicitly starts playing, ignore the "REOPEN_AFTER" timeout.
This timeout was useful when MPD attempted to reopen a failed device
over and over, but it confuses users when they explicitly tell MPD to
start playing, while MPD insists to wait for the 10 seconds to pass.
This commit is contained in:
Max Kellermann 2009-02-10 22:15:42 +01:00
parent e8aee4d992
commit b21e8ad4a5

View File

@ -149,6 +149,18 @@ static void audio_output_wait_all(void)
notify_wait(&audio_output_client_notify);
}
/**
* Resets the "reopen" flag on all audio devices. MPD should
* immediately retry to open the device instead of waiting for the
* timeout when the user wants to start playback.
*/
static void
audio_output_all_reset_reopen(void)
{
for (unsigned i = 0; i < num_audio_outputs; ++i)
audio_outputs[i].reopen_after = 0;
}
static void
audio_output_all_update(void)
{
@ -216,6 +228,7 @@ audio_output_all_open(const struct audio_format *audio_format)
if (audio_format != NULL)
input_audio_format = *audio_format;
audio_output_all_reset_reopen();
audio_output_all_update();
for (i = 0; i < num_audio_outputs; ++i) {