diff options
-rw-r--r-- | apps/playback.c | 17 |
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) | |||
425 | #endif /* PLAYBACK_VOICE */ | 425 | #endif /* PLAYBACK_VOICE */ |
426 | } | 426 | } |
427 | 427 | ||
428 | /* This sends a stop message and the audio thread will dump all it's | ||
429 | subsequenct messages */ | ||
430 | static void audio_hard_stop(void) | ||
431 | { | ||
432 | /* Stop playback */ | ||
433 | LOGFQUEUE("audio >| audio Q_AUDIO_STOP: 1"); | ||
434 | queue_send(&audio_queue, Q_AUDIO_STOP, 1); | ||
435 | } | ||
436 | |||
428 | unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size) | 437 | unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size) |
429 | { | 438 | { |
430 | unsigned char *buf, *end; | 439 | unsigned char *buf, *end; |
431 | 440 | ||
432 | if (audio_is_initialized) | 441 | if (audio_is_initialized) |
433 | { | 442 | { |
434 | audio_stop(); | 443 | audio_hard_stop(); |
435 | wait_for_voice_swap_in(); | 444 | wait_for_voice_swap_in(); |
436 | voice_stop(); | 445 | voice_stop(); |
437 | } | 446 | } |
@@ -488,7 +497,7 @@ unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size) | |||
488 | void audio_iram_steal(void) | 497 | void audio_iram_steal(void) |
489 | { | 498 | { |
490 | /* We need to stop audio playback in order to use codec IRAM */ | 499 | /* We need to stop audio playback in order to use codec IRAM */ |
491 | audio_stop(); | 500 | audio_hard_stop(); |
492 | 501 | ||
493 | #ifdef PLAYBACK_VOICE | 502 | #ifdef PLAYBACK_VOICE |
494 | if (NULL != iram_buf) | 503 | if (NULL != iram_buf) |
@@ -527,7 +536,7 @@ unsigned char *audio_get_recording_buffer(size_t *buffer_size) | |||
527 | 536 | ||
528 | /* Stop audio and voice. Wait for voice to swap in and be clear | 537 | /* Stop audio and voice. Wait for voice to swap in and be clear |
529 | of pending events to ensure trouble-free operation of encoders */ | 538 | of pending events to ensure trouble-free operation of encoders */ |
530 | audio_stop(); | 539 | audio_hard_stop(); |
531 | wait_for_voice_swap_in(); | 540 | wait_for_voice_swap_in(); |
532 | voice_stop(); | 541 | voice_stop(); |
533 | talk_buffer_steal(); | 542 | talk_buffer_steal(); |
@@ -3636,6 +3645,8 @@ static void audio_thread(void) | |||
3636 | case Q_AUDIO_STOP: | 3645 | case Q_AUDIO_STOP: |
3637 | LOGFQUEUE("audio < Q_AUDIO_STOP"); | 3646 | LOGFQUEUE("audio < Q_AUDIO_STOP"); |
3638 | audio_stop_playback(); | 3647 | audio_stop_playback(); |
3648 | if (ev.data != 0) | ||
3649 | queue_clear(&audio_queue); | ||
3639 | break ; | 3650 | break ; |
3640 | 3651 | ||
3641 | case Q_AUDIO_PAUSE: | 3652 | case Q_AUDIO_PAUSE: |