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
1 changed files with 3 additions and 5 deletions

View File

@ -232,6 +232,7 @@ audio_output_all_open(const struct audio_format *audio_format,
bool ret = false, enabled = false;
unsigned int i;
assert(audio_format != NULL);
assert(buffer != NULL);
assert(g_music_buffer == NULL || g_music_buffer == buffer);
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
pipe */
assert(audio_format == NULL || g_mp == NULL ||
music_pipe_check_format(g_mp, audio_format));
assert(g_mp == NULL || music_pipe_check_format(g_mp, audio_format));
if (g_mp == NULL)
g_mp = music_pipe_new();
@ -249,12 +249,10 @@ audio_output_all_open(const struct audio_format *audio_format,
/* if the pipe hasn't been cleared, the the audio
format must not have changed */
assert(music_pipe_size(g_mp) == 0 ||
audio_format == NULL ||
audio_format_equals(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_update();