Esempio n. 1
0
void audio_output_close(struct audio_output *ao)
{
    assert(ao != NULL);
    assert(!ao->open || ao->fail_timer == NULL);

    g_mutex_lock(ao->mutex);
    audio_output_close_locked(ao);
    g_mutex_unlock(ao->mutex);
}
Esempio n. 2
0
bool
audio_output_update(struct audio_output *ao,
		    const struct audio_format *audio_format,
		    const struct music_pipe *mp)
{
	assert(mp != NULL);

	g_mutex_lock(ao->mutex);

	if (ao->enabled && ao->really_enabled) {
		if (ao->fail_timer == NULL ||
		    g_timer_elapsed(ao->fail_timer, NULL) > REOPEN_AFTER) {
			bool success = audio_output_open(ao, audio_format, mp);
			g_mutex_unlock(ao->mutex);
			return success;
		}
	} else if (audio_output_is_open(ao))
		audio_output_close_locked(ao);

	g_mutex_unlock(ao->mutex);
	return false;
}