From ee7c13514e2da02e7fad214cf032361230bb55cb Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 23 Dec 2013 12:48:26 +0100 Subject: [PATCH] hwcodec: Need to grab audio buffer before recording. This was missed in 22e802e because I didn't realize that hwcodec doesn't compile pcm_record.c. Change-Id: I48cd4c2beec0a3d01caf06f2a2ced98be22a3673 --- apps/mpeg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/mpeg.c b/apps/mpeg.c index 5fd1bfdb82..1400b6db71 100644 --- a/apps/mpeg.c +++ b/apps/mpeg.c @@ -258,6 +258,9 @@ static void pause_recording(void); static void resume_recording(void); #endif /* (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) */ +static void audio_reset_buffer_noalloc(void* buf, size_t bufsize); +static void audio_reset_buffer(void); + #ifndef SIMULATOR static int num_tracks_in_memory(void) @@ -517,7 +520,6 @@ static void do_stop(void) #endif } -static void audio_reset_buffer_noalloc(void* buf, size_t bufsize); /* Buffer must not move. */ static int shrink_callback(int handle, unsigned hints, void* start, size_t old_size) { @@ -525,6 +527,13 @@ static int shrink_callback(int handle, unsigned hints, void* start, size_t old_s /* check what buflib requests */ size_t wanted_size = (hints & BUFLIB_SHRINK_SIZE_MASK); ssize_t size = (ssize_t)old_size - wanted_size; + +#ifndef SIMULATOR + /* FIXME: Cannot give the buffer during recording yet */ + if (is_recording) + return BUFLIB_CB_CANNOT_SHRINK; +#endif + /* keep at least 256K for the buffering */ if ((size - extradata_size) < AUDIO_BUFFER_RESERVE) { @@ -2201,6 +2210,9 @@ static void init_recording(void) is_recording = false; is_prerecording = false; + /* Have to grab the audio buffer in case voice had it */ + audio_reset_buffer(); + mpeg_stop_done = true; mas_reset();