Some corrections after 5857c44.

Playback needs to receive a couple of settings-related messages even
when not playing.

Put the message reply back where it was when loading an encoder for
recording.

Change-Id: I8cc80f46e42a0afd119991d698510e1ebef38ead
This commit is contained in:
Michael Sevakis 2013-05-31 04:13:39 -04:00
parent 5857c44017
commit 344b9d0986
3 changed files with 18 additions and 7 deletions

View file

@ -79,6 +79,14 @@ static void NORETURN_ATTR audio_thread(void)
audio_playback_handler(&ev);
continue;
/* Playback has to handle these, even if not playing */
case Q_AUDIO_REMAKE_AUDIO_BUFFER:
#ifdef HAVE_DISK_STORAGE
case Q_AUDIO_UPDATE_WATERMARK:
#endif
audio_playback_handler(&ev);
break;
#ifdef AUDIO_HAVE_RECORDING
/* Starts the recording engine branch */
case Q_AUDIO_INIT_RECORDING:
@ -132,10 +140,6 @@ void audio_init(void)
logf("audio: initializing");
playback_init();
/* Recording doesn't need init call */
/* Initialize queues before giving control elsewhere in case it likes
to send messages. Thread creation will be delayed however so nothing
starts running until ready if something yields such as talk_init. */
@ -151,6 +155,9 @@ void audio_init(void)
queue_enable_queue_send(&audio_queue, &audio_queue_sender_list,
audio_thread_id);
playback_init();
/* Recording doesn't need init call */
/* ...now...audio_reset_buffer must know the size of voicefile buffer so
init talk first which will init the buffers */
talk_init();

View file

@ -3078,6 +3078,8 @@ void audio_playback_handler(struct queue_event *ev)
/* buffer needs to be reinitialized */
LOGFQUEUE("playback < Q_AUDIO_REMAKE_AUDIO_BUFFER");
audio_start_playback(0, AUDIO_START_RESTART | AUDIO_START_NEWBUF);
if (play_status == PLAY_STOPPED)
return; /* just need to change buffer state */
break;
#ifdef HAVE_DISK_STORAGE
@ -3086,6 +3088,8 @@ void audio_playback_handler(struct queue_event *ev)
LOGFQUEUE("playback < Q_AUDIO_UPDATE_WATERMARK: %d",
(int)ev->data);
audio_update_filebuf_watermark(ev->data);
if (play_status == PLAY_STOPPED)
return; /* just need to update setting */
break;
#endif /* HAVE_DISK_STORAGE */

View file

@ -1191,7 +1191,6 @@ static void pcmrec_close(void)
/* PCMREC_OPTIONS */
static void pcmrec_set_recording_options(
struct event_queue *q,
struct audio_recording_options *options)
{
/* stop everything */
@ -1237,9 +1236,10 @@ static void pcmrec_set_recording_options(
/* apply hardware setting to start monitoring now */
pcm_apply_settings();
queue_reply(&audio_queue, 0); /* Release sender */
if (codec_load(-1, enc_config.afmt | CODEC_TYPE_ENCODER))
{
queue_reply(q, true);
/* run immediately */
codec_go();
@ -1487,7 +1487,7 @@ void audio_recording_handler(struct queue_event *ev)
return; /* no more recording */
case Q_AUDIO_RECORDING_OPTIONS:
pcmrec_set_recording_options(&audio_queue,
pcmrec_set_recording_options(
(struct audio_recording_options *)ev->data);
break;