diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-10-27 12:11:45 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-10-27 12:11:45 +0000 |
commit | 3c1d2069ddaacfc8223ac2f741ab2577f2e4ba38 (patch) | |
tree | d0f5124838d8895c396396c807585afa32f389d1 | |
parent | 738a897fa0fc8a86b4f970c1bfb26f698647a452 (diff) | |
download | rockbox-3c1d2069ddaacfc8223ac2f741ab2577f2e4ba38.tar.gz rockbox-3c1d2069ddaacfc8223ac2f741ab2577f2e4ba38.zip |
Make voice and codec queues private so they don't receive system messages. The audio thread controls them just fine. Important so codec stack-stealing plugins don't crash when system events are broadcast. Simpler too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15333 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/playback.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/apps/playback.c b/apps/playback.c index 27610e01fb..2425cf5376 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1255,24 +1255,6 @@ static void* voice_request_buffer_callback(size_t *realsize, size_t reqsize) | |||
1255 | return NULL; | 1255 | return NULL; |
1256 | break; | 1256 | break; |
1257 | 1257 | ||
1258 | case SYS_USB_CONNECTED: | ||
1259 | { | ||
1260 | LOGFQUEUE("voice < SYS_USB_CONNECTED"); | ||
1261 | bool change_tracks = voice_on_voice_stop(ev.data, realsize); | ||
1262 | /* Voice is obviously current so let us swap ourselves away if | ||
1263 | playing so audio may stop itself - audio_codec_loaded can | ||
1264 | only be true in this case if we're here even if the codec | ||
1265 | is only about to load */ | ||
1266 | if (audio_codec_loaded) | ||
1267 | swap_codec(); | ||
1268 | /* Playback should be finished by now - ack and wait */ | ||
1269 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | ||
1270 | usb_wait_for_disconnect(&voice_queue); | ||
1271 | if (change_tracks) | ||
1272 | return NULL; | ||
1273 | break; | ||
1274 | } | ||
1275 | |||
1276 | case Q_VOICE_PLAY: | 1258 | case Q_VOICE_PLAY: |
1277 | LOGFQUEUE("voice < Q_VOICE_PLAY"); | 1259 | LOGFQUEUE("voice < Q_VOICE_PLAY"); |
1278 | if (!voice_is_playing) | 1260 | if (!voice_is_playing) |
@@ -1984,15 +1966,6 @@ static void codec_thread(void) | |||
1984 | break; | 1966 | break; |
1985 | #endif /* AUDIO_HAVE_RECORDING */ | 1967 | #endif /* AUDIO_HAVE_RECORDING */ |
1986 | 1968 | ||
1987 | #ifndef SIMULATOR | ||
1988 | case SYS_USB_CONNECTED: | ||
1989 | LOGFQUEUE("codec < SYS_USB_CONNECTED"); | ||
1990 | queue_clear(&codec_queue); | ||
1991 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | ||
1992 | usb_wait_for_disconnect(&codec_queue); | ||
1993 | break; | ||
1994 | #endif | ||
1995 | |||
1996 | default: | 1969 | default: |
1997 | LOGFQUEUE("codec < default"); | 1970 | LOGFQUEUE("codec < default"); |
1998 | } | 1971 | } |
@@ -3218,6 +3191,10 @@ static void audio_thread(void) | |||
3218 | LOGFQUEUE("audio < SYS_USB_CONNECTED"); | 3191 | LOGFQUEUE("audio < SYS_USB_CONNECTED"); |
3219 | if (playing) | 3192 | if (playing) |
3220 | audio_stop_playback(); | 3193 | audio_stop_playback(); |
3194 | #ifdef PLAYBACK_VOICE | ||
3195 | wait_for_voice_swap_in(); | ||
3196 | voice_stop(); | ||
3197 | #endif | ||
3221 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | 3198 | usb_acknowledge(SYS_USB_CONNECTED_ACK); |
3222 | usb_wait_for_disconnect(&audio_queue); | 3199 | usb_wait_for_disconnect(&audio_queue); |
3223 | /* release tracks to make sure all handles are closed */ | 3200 | /* release tracks to make sure all handles are closed */ |
@@ -3278,7 +3255,7 @@ void audio_init(void) | |||
3278 | #endif | 3255 | #endif |
3279 | queue_init(&audio_queue, true); | 3256 | queue_init(&audio_queue, true); |
3280 | queue_enable_queue_send(&audio_queue, &audio_queue_sender_list); | 3257 | queue_enable_queue_send(&audio_queue, &audio_queue_sender_list); |
3281 | queue_init(&codec_queue, true); | 3258 | queue_init(&codec_queue, false); |
3282 | queue_enable_queue_send(&codec_queue, &codec_queue_sender_list); | 3259 | queue_enable_queue_send(&codec_queue, &codec_queue_sender_list); |
3283 | 3260 | ||
3284 | pcm_init(); | 3261 | pcm_init(); |
@@ -3350,7 +3327,7 @@ void audio_init(void) | |||
3350 | if (talk_voice_required()) | 3327 | if (talk_voice_required()) |
3351 | { | 3328 | { |
3352 | logf("Starting voice codec"); | 3329 | logf("Starting voice codec"); |
3353 | queue_init(&voice_queue, true); | 3330 | queue_init(&voice_queue, false); |
3354 | voice_thread_p = create_thread(voice_thread, voice_stack, | 3331 | voice_thread_p = create_thread(voice_thread, voice_stack, |
3355 | sizeof(voice_stack), CREATE_THREAD_FROZEN, | 3332 | sizeof(voice_stack), CREATE_THREAD_FROZEN, |
3356 | voice_thread_name | 3333 | voice_thread_name |