From d7e8e3825341b6b8007d7174e4874c1c5d4542d4 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 3 May 2007 21:49:59 +0000 Subject: Audio seemed never to want to stop stopping. A bad condition for plugins that want to stop audio and begin pcm playback immediately. Only do the stop if the state is playing. Properly wait for it to be done as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13317 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'apps/playback.c') diff --git a/apps/playback.c b/apps/playback.c index 545076954f..b26754eb3a 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -695,12 +695,9 @@ void audio_play(long offset) void audio_stop(void) { /* Stop playback */ - LOGFQUEUE("audio > audio Q_AUDIO_STOP"); - queue_post(&audio_queue, Q_AUDIO_STOP, 0); - + LOGFQUEUE("audio >| audio Q_AUDIO_STOP"); /* Don't return until playback has actually stopped */ - while(playing || !queue_empty(&audio_queue)) - yield(); + queue_send(&audio_queue, Q_AUDIO_STOP, 0); } void audio_pause(void) @@ -3644,7 +3641,8 @@ static void audio_thread(void) case Q_AUDIO_STOP: LOGFQUEUE("audio < Q_AUDIO_STOP"); - audio_stop_playback(); + if (playing) + audio_stop_playback(); if (ev.data != 0) queue_clear(&audio_queue); break ; -- cgit v1.2.3