diff options
author | Thomas Martitz <kugel@rockbox.org> | 2013-12-23 12:48:26 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-12-23 12:53:06 +0100 |
commit | ee7c13514e2da02e7fad214cf032361230bb55cb (patch) | |
tree | e77a10fa505f655943dfc30fa90e3bcb9b86b7af | |
parent | ec6258f936487cb92e68e7d6ee3ba864786378bd (diff) | |
download | rockbox-ee7c135.tar.gz rockbox-ee7c135.zip |
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
-rw-r--r-- | apps/mpeg.c | 14 |
1 files changed, 13 insertions, 1 deletions
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(); |