summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-04-12 05:58:09 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-04-12 05:58:09 +0000
commit9cd6394d8c1b1cfc74540f1ed43171a9893e1e4d (patch)
tree72e45659d940b011f375fd46ae4b6e6a56691a93 /apps
parent6c9a433ca15f40f268fe26515c9ba1629dc00c3d (diff)
downloadrockbox-9cd6394d8c1b1cfc74540f1ed43171a9893e1e4d.tar.gz
rockbox-9cd6394d8c1b1cfc74540f1ed43171a9893e1e4d.zip
SWCODEC: Fix a race condition caused by yielding in pcm_mute that could have playback messing around with pcm after supposedly being fully stopped. The pcm buffer mutes consistently on some players (the PP ones) which made audio_stop return too soon. Won't matter if it yields or not now and this should take care of the mpegplayer 'next video' issue.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13117 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c
index a4f5bee9fc..545076954f 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -425,13 +425,22 @@ static void wait_for_voice_swap_in(void)
#endif /* PLAYBACK_VOICE */
}
+/* This sends a stop message and the audio thread will dump all it's
+ subsequenct messages */
+static void audio_hard_stop(void)
+{
+ /* Stop playback */
+ LOGFQUEUE("audio >| audio Q_AUDIO_STOP: 1");
+ queue_send(&audio_queue, Q_AUDIO_STOP, 1);
+}
+
unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size)
{
unsigned char *buf, *end;
if (audio_is_initialized)
{
- audio_stop();
+ audio_hard_stop();
wait_for_voice_swap_in();
voice_stop();
}
@@ -488,7 +497,7 @@ unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size)
void audio_iram_steal(void)
{
/* We need to stop audio playback in order to use codec IRAM */
- audio_stop();
+ audio_hard_stop();
#ifdef PLAYBACK_VOICE
if (NULL != iram_buf)
@@ -527,7 +536,7 @@ unsigned char *audio_get_recording_buffer(size_t *buffer_size)
/* Stop audio and voice. Wait for voice to swap in and be clear
of pending events to ensure trouble-free operation of encoders */
- audio_stop();
+ audio_hard_stop();
wait_for_voice_swap_in();
voice_stop();
talk_buffer_steal();
@@ -3636,6 +3645,8 @@ static void audio_thread(void)
case Q_AUDIO_STOP:
LOGFQUEUE("audio < Q_AUDIO_STOP");
audio_stop_playback();
+ if (ev.data != 0)
+ queue_clear(&audio_queue);
break ;
case Q_AUDIO_PAUSE: