output: fixed shout stuck pause bug

Explicitly make the output thread leave the ao_pause() loop.  This
patch is a workaround, and the "pause" flag is not managed in a
thread-safe way, but that's good enough for now.
This commit is contained in:
Max Kellermann 2009-08-14 11:52:12 +02:00
parent 7dddd9beda
commit 7133f560ec
4 changed files with 22 additions and 0 deletions

2
NEWS
View File

@ -6,6 +6,8 @@ ver 0.15.2 (2009/??/??)
- mad: skip ID3 frames when libid3tag is disabled - mad: skip ID3 frames when libid3tag is disabled
- flac: parse all replaygain tags - flac: parse all replaygain tags
- flac: don't allocate cuesheet twice (memleak) - flac: don't allocate cuesheet twice (memleak)
* output:
- shout: fixed stuck pause bug
* update: free empty path string (memleak) * update: free empty path string (memleak)
* update: free temporary string in container scan (memleak) * update: free temporary string in container scan (memleak)
* directory: free empty directories after removing them (memleak) * directory: free empty directories after removing them (memleak)

View File

@ -76,6 +76,17 @@ audio_output_open(struct audio_output *ao,
audio_format_equals(audio_format, &ao->in_audio_format)) { audio_format_equals(audio_format, &ao->in_audio_format)) {
assert(ao->pipe == mp); assert(ao->pipe == mp);
if (ao->pause) {
/* unpause with the CANCEL command; this is a
hack, but suits well for forcing the thread
to leave the ao_pause() thread, and we need
to flush the device buffer anyway */
/* we're not using audio_output_cancel() here,
because that function is asynchronous */
ao_command(ao, AO_COMMAND_CANCEL);
}
return true; return true;
} }

View File

@ -80,6 +80,12 @@ struct audio_output {
*/ */
bool open; bool open;
/**
* Is the device paused? i.e. the output thread is in the
* ao_pause() loop.
*/
bool pause;
/** /**
* If not NULL, the device has failed, and this timer is used * If not NULL, the device has failed, and this timer is used
* to estimate how long it should stay disabled (unless * to estimate how long it should stay disabled (unless

View File

@ -165,6 +165,7 @@ static void ao_pause(struct audio_output *ao)
bool ret; bool ret;
ao_plugin_cancel(ao->plugin, ao->data); ao_plugin_cancel(ao->plugin, ao->data);
ao->pause = true;
ao_command_finished(ao); ao_command_finished(ao);
do { do {
@ -174,6 +175,8 @@ static void ao_pause(struct audio_output *ao)
break; break;
} }
} while (ao->command == AO_COMMAND_NONE); } while (ao->command == AO_COMMAND_NONE);
ao->pause = false;
} }
static gpointer audio_output_task(gpointer arg) static gpointer audio_output_task(gpointer arg)