output_all: don't allow audio_format==NULL in audio_output_all_open()

Don't allow reopening an audio device after pause with
audio_format==NULL, force the caller to provide the audio_format each
time.
This commit is contained in:
Max Kellermann 2009-03-10 21:04:45 +01:00
parent d3eccb2324
commit f2ec6ee184

View File

@ -232,6 +232,7 @@ audio_output_all_open(const struct audio_format *audio_format,
bool ret = false, enabled = false; bool ret = false, enabled = false;
unsigned int i; unsigned int i;
assert(audio_format != NULL);
assert(buffer != NULL); assert(buffer != NULL);
assert(g_music_buffer == NULL || g_music_buffer == buffer); assert(g_music_buffer == NULL || g_music_buffer == buffer);
assert((g_mp == NULL) == (g_music_buffer == NULL)); assert((g_mp == NULL) == (g_music_buffer == NULL));
@ -240,8 +241,7 @@ audio_output_all_open(const struct audio_format *audio_format,
/* the audio format must be the same as existing chunks in the /* the audio format must be the same as existing chunks in the
pipe */ pipe */
assert(audio_format == NULL || g_mp == NULL || assert(g_mp == NULL || music_pipe_check_format(g_mp, audio_format));
music_pipe_check_format(g_mp, audio_format));
if (g_mp == NULL) if (g_mp == NULL)
g_mp = music_pipe_new(); g_mp = music_pipe_new();
@ -249,11 +249,9 @@ audio_output_all_open(const struct audio_format *audio_format,
/* if the pipe hasn't been cleared, the the audio /* if the pipe hasn't been cleared, the the audio
format must not have changed */ format must not have changed */
assert(music_pipe_size(g_mp) == 0 || assert(music_pipe_size(g_mp) == 0 ||
audio_format == NULL ||
audio_format_equals(audio_format, audio_format_equals(audio_format,
&input_audio_format)); &input_audio_format));
if (audio_format != NULL)
input_audio_format = *audio_format; input_audio_format = *audio_format;
audio_output_all_reset_reopen(); audio_output_all_reset_reopen();