summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2013-12-23 12:48:26 +0100
committerThomas Martitz <kugel@rockbox.org>2013-12-23 12:53:06 +0100
commitee7c13514e2da02e7fad214cf032361230bb55cb (patch)
treee77a10fa505f655943dfc30fa90e3bcb9b86b7af /apps
parentec6258f936487cb92e68e7d6ee3ba864786378bd (diff)
downloadrockbox-ee7c13514e2da02e7fad214cf032361230bb55cb.tar.gz
rockbox-ee7c13514e2da02e7fad214cf032361230bb55cb.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
Diffstat (limited to 'apps')
-rw-r--r--apps/mpeg.c14
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);
258static void resume_recording(void); 258static void resume_recording(void);
259#endif /* (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) */ 259#endif /* (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) */
260 260
261static void audio_reset_buffer_noalloc(void* buf, size_t bufsize);
262static void audio_reset_buffer(void);
263
261 264
262#ifndef SIMULATOR 265#ifndef SIMULATOR
263static int num_tracks_in_memory(void) 266static int num_tracks_in_memory(void)
@@ -517,7 +520,6 @@ static void do_stop(void)
517#endif 520#endif
518} 521}
519 522
520static void audio_reset_buffer_noalloc(void* buf, size_t bufsize);
521/* Buffer must not move. */ 523/* Buffer must not move. */
522static int shrink_callback(int handle, unsigned hints, void* start, size_t old_size) 524static int shrink_callback(int handle, unsigned hints, void* start, size_t old_size)
523{ 525{
@@ -525,6 +527,13 @@ static int shrink_callback(int handle, unsigned hints, void* start, size_t old_s
525 /* check what buflib requests */ 527 /* check what buflib requests */
526 size_t wanted_size = (hints & BUFLIB_SHRINK_SIZE_MASK); 528 size_t wanted_size = (hints & BUFLIB_SHRINK_SIZE_MASK);
527 ssize_t size = (ssize_t)old_size - wanted_size; 529 ssize_t size = (ssize_t)old_size - wanted_size;
530
531#ifndef SIMULATOR
532 /* FIXME: Cannot give the buffer during recording yet */
533 if (is_recording)
534 return BUFLIB_CB_CANNOT_SHRINK;
535#endif
536
528 /* keep at least 256K for the buffering */ 537 /* keep at least 256K for the buffering */
529 if ((size - extradata_size) < AUDIO_BUFFER_RESERVE) 538 if ((size - extradata_size) < AUDIO_BUFFER_RESERVE)
530 { 539 {
@@ -2201,6 +2210,9 @@ static void init_recording(void)
2201 is_recording = false; 2210 is_recording = false;
2202 is_prerecording = false; 2211 is_prerecording = false;
2203 2212
2213 /* Have to grab the audio buffer in case voice had it */
2214 audio_reset_buffer();
2215
2204 mpeg_stop_done = true; 2216 mpeg_stop_done = true;
2205 2217
2206 mas_reset(); 2218 mas_reset();