summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2006-11-13 09:07:18 +0000
committerSteve Bavin <pondlife@pondlife.me>2006-11-13 09:07:18 +0000
commit6a27006a5ddf70926f9d45a0ce17a26473ecc403 (patch)
tree82c4af20edea4ba4150f4b4d7216a854804b271f /apps/playback.c
parent0297873f6ac3a9dc0844dc3da9d432e4253d555d (diff)
Minor voice fixes; prevent voice queue overflow, fix compile of voice-less build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11521 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 62dd039274..dccae587b9 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -192,7 +192,7 @@ static bool audio_is_initialized = false;
/* Variables are commented with the threads that use them: *
* A=audio, C=codec, V=voice. A suffix of - indicates that *
* the variable is read but not updated on that thread. */
-/* TBD: Split out "audio" and "calling" threads */
+/* TBD: Split out "audio" and "playback" (ie. calling) threads */
/* Main state control */
static struct event_queue codec_callback_queue; /* Queue for codec callback responses */
@@ -348,6 +348,7 @@ void mp3_play_data(const unsigned char* start, int size,
void mp3_play_stop(void)
{
#ifdef PLAYBACK_VOICE
+ queue_remove_from_head(&voice_queue, Q_VOICE_STOP);
LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
queue_post(&voice_queue, Q_VOICE_STOP, (void *)1);
#endif
@@ -807,7 +808,7 @@ void voice_stop(void)
LOGFQUEUE("mp3 > voice Q_VOICE_STOP");
queue_post(&voice_queue, Q_VOICE_STOP, 0);
- while (voice_is_playing)
+ while (voice_is_playing || !queue_empty(&voice_queue))
yield();
if (!playing)
pcmbuf_play_stop();
@@ -1880,13 +1881,15 @@ static void codec_thread(void)
LOGFQUEUE("codec > voice Q_ENCODER_RECORD");
queue_post(&voice_queue, Q_ENCODER_RECORD, NULL);
}
-#endif
mutex_lock(&mutex_codecthread);
+#endif
logf("loading encoder");
current_codec = CODEC_IDX_AUDIO;
ci.stop_codec = false;
status = codec_load_file((const char *)ev.data, &ci);
+#ifdef PLAYBACK_VOICE
mutex_unlock(&mutex_codecthread);
+#endif
logf("encoder stopped");
break;
#endif /* AUDIO_HAVE_RECORDING */