diff options
-rw-r--r-- | apps/audio_thread.c | 15 | ||||
-rw-r--r-- | apps/playback.c | 4 | ||||
-rw-r--r-- | apps/recorder/pcm_record.c | 6 |
3 files changed, 18 insertions, 7 deletions
diff --git a/apps/audio_thread.c b/apps/audio_thread.c index 2f01f7a8c2..56f3853c6c 100644 --- a/apps/audio_thread.c +++ b/apps/audio_thread.c | |||
@@ -79,6 +79,14 @@ static void NORETURN_ATTR audio_thread(void) | |||
79 | audio_playback_handler(&ev); | 79 | audio_playback_handler(&ev); |
80 | continue; | 80 | continue; |
81 | 81 | ||
82 | /* Playback has to handle these, even if not playing */ | ||
83 | case Q_AUDIO_REMAKE_AUDIO_BUFFER: | ||
84 | #ifdef HAVE_DISK_STORAGE | ||
85 | case Q_AUDIO_UPDATE_WATERMARK: | ||
86 | #endif | ||
87 | audio_playback_handler(&ev); | ||
88 | break; | ||
89 | |||
82 | #ifdef AUDIO_HAVE_RECORDING | 90 | #ifdef AUDIO_HAVE_RECORDING |
83 | /* Starts the recording engine branch */ | 91 | /* Starts the recording engine branch */ |
84 | case Q_AUDIO_INIT_RECORDING: | 92 | case Q_AUDIO_INIT_RECORDING: |
@@ -132,10 +140,6 @@ void audio_init(void) | |||
132 | 140 | ||
133 | logf("audio: initializing"); | 141 | logf("audio: initializing"); |
134 | 142 | ||
135 | playback_init(); | ||
136 | |||
137 | /* Recording doesn't need init call */ | ||
138 | |||
139 | /* Initialize queues before giving control elsewhere in case it likes | 143 | /* Initialize queues before giving control elsewhere in case it likes |
140 | to send messages. Thread creation will be delayed however so nothing | 144 | to send messages. Thread creation will be delayed however so nothing |
141 | starts running until ready if something yields such as talk_init. */ | 145 | starts running until ready if something yields such as talk_init. */ |
@@ -151,6 +155,9 @@ void audio_init(void) | |||
151 | queue_enable_queue_send(&audio_queue, &audio_queue_sender_list, | 155 | queue_enable_queue_send(&audio_queue, &audio_queue_sender_list, |
152 | audio_thread_id); | 156 | audio_thread_id); |
153 | 157 | ||
158 | playback_init(); | ||
159 | /* Recording doesn't need init call */ | ||
160 | |||
154 | /* ...now...audio_reset_buffer must know the size of voicefile buffer so | 161 | /* ...now...audio_reset_buffer must know the size of voicefile buffer so |
155 | init talk first which will init the buffers */ | 162 | init talk first which will init the buffers */ |
156 | talk_init(); | 163 | talk_init(); |
diff --git a/apps/playback.c b/apps/playback.c index 01fa7a9dda..894c379b7e 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -3078,6 +3078,8 @@ void audio_playback_handler(struct queue_event *ev) | |||
3078 | /* buffer needs to be reinitialized */ | 3078 | /* buffer needs to be reinitialized */ |
3079 | LOGFQUEUE("playback < Q_AUDIO_REMAKE_AUDIO_BUFFER"); | 3079 | LOGFQUEUE("playback < Q_AUDIO_REMAKE_AUDIO_BUFFER"); |
3080 | audio_start_playback(0, AUDIO_START_RESTART | AUDIO_START_NEWBUF); | 3080 | audio_start_playback(0, AUDIO_START_RESTART | AUDIO_START_NEWBUF); |
3081 | if (play_status == PLAY_STOPPED) | ||
3082 | return; /* just need to change buffer state */ | ||
3081 | break; | 3083 | break; |
3082 | 3084 | ||
3083 | #ifdef HAVE_DISK_STORAGE | 3085 | #ifdef HAVE_DISK_STORAGE |
@@ -3086,6 +3088,8 @@ void audio_playback_handler(struct queue_event *ev) | |||
3086 | LOGFQUEUE("playback < Q_AUDIO_UPDATE_WATERMARK: %d", | 3088 | LOGFQUEUE("playback < Q_AUDIO_UPDATE_WATERMARK: %d", |
3087 | (int)ev->data); | 3089 | (int)ev->data); |
3088 | audio_update_filebuf_watermark(ev->data); | 3090 | audio_update_filebuf_watermark(ev->data); |
3091 | if (play_status == PLAY_STOPPED) | ||
3092 | return; /* just need to update setting */ | ||
3089 | break; | 3093 | break; |
3090 | #endif /* HAVE_DISK_STORAGE */ | 3094 | #endif /* HAVE_DISK_STORAGE */ |
3091 | 3095 | ||
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c index a45dcc2d11..3b3211afab 100644 --- a/apps/recorder/pcm_record.c +++ b/apps/recorder/pcm_record.c | |||
@@ -1191,7 +1191,6 @@ static void pcmrec_close(void) | |||
1191 | 1191 | ||
1192 | /* PCMREC_OPTIONS */ | 1192 | /* PCMREC_OPTIONS */ |
1193 | static void pcmrec_set_recording_options( | 1193 | static void pcmrec_set_recording_options( |
1194 | struct event_queue *q, | ||
1195 | struct audio_recording_options *options) | 1194 | struct audio_recording_options *options) |
1196 | { | 1195 | { |
1197 | /* stop everything */ | 1196 | /* stop everything */ |
@@ -1237,9 +1236,10 @@ static void pcmrec_set_recording_options( | |||
1237 | /* apply hardware setting to start monitoring now */ | 1236 | /* apply hardware setting to start monitoring now */ |
1238 | pcm_apply_settings(); | 1237 | pcm_apply_settings(); |
1239 | 1238 | ||
1239 | queue_reply(&audio_queue, 0); /* Release sender */ | ||
1240 | |||
1240 | if (codec_load(-1, enc_config.afmt | CODEC_TYPE_ENCODER)) | 1241 | if (codec_load(-1, enc_config.afmt | CODEC_TYPE_ENCODER)) |
1241 | { | 1242 | { |
1242 | queue_reply(q, true); | ||
1243 | 1243 | ||
1244 | /* run immediately */ | 1244 | /* run immediately */ |
1245 | codec_go(); | 1245 | codec_go(); |
@@ -1487,7 +1487,7 @@ void audio_recording_handler(struct queue_event *ev) | |||
1487 | return; /* no more recording */ | 1487 | return; /* no more recording */ |
1488 | 1488 | ||
1489 | case Q_AUDIO_RECORDING_OPTIONS: | 1489 | case Q_AUDIO_RECORDING_OPTIONS: |
1490 | pcmrec_set_recording_options(&audio_queue, | 1490 | pcmrec_set_recording_options( |
1491 | (struct audio_recording_options *)ev->data); | 1491 | (struct audio_recording_options *)ev->data); |
1492 | break; | 1492 | break; |
1493 | 1493 | ||