aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-29 22:17:42 +0100
committerMax Kellermann <max@duempel.org>2008-10-29 22:17:42 +0100
commit678314534a08dbcbc1c642446f1af899a2108b57 (patch)
tree494d6e0c776bb914b560f29717f19802daefff53 /src/output_thread.c
parent07bb46de88a6af3547d40452771e687a45592404 (diff)
downloadmpd-678314534a08dbcbc1c642446f1af899a2108b57.tar.gz
mpd-678314534a08dbcbc1c642446f1af899a2108b57.tar.xz
mpd-678314534a08dbcbc1c642446f1af899a2108b57.zip
output: always call cancel() before stop()
Stopping an audio output device without cancelling its buffer doesn't make sense. Combine the two operations, which saves several cancel calls.
Diffstat (limited to 'src/output_thread.c')
-rw-r--r--src/output_thread.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/output_thread.c b/src/output_thread.c
index 825dfa5f5..28a575a1b 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -63,6 +63,7 @@ static void ao_play(struct audio_output *ao)
ao->result = ao->plugin->play(ao->data, data, size);
if (!ao->result) {
+ ao->plugin->cancel(ao->data);
ao->plugin->close(ao->data);
ao->open = false;
}
@@ -72,6 +73,8 @@ static void ao_play(struct audio_output *ao)
static void ao_pause(struct audio_output *ao)
{
+ ao->plugin->cancel(ao->data);
+
if (ao->plugin->pause != NULL) {
/* pause is supported */
ao_command_finished(ao);
@@ -107,6 +110,7 @@ static void *audio_output_task(void *arg)
case AO_COMMAND_CLOSE:
assert(ao->open);
+ ao->plugin->cancel(ao->data);
ao->plugin->close(ao->data);
ao->open = false;
ao_command_finished(ao);