diff options
Diffstat (limited to 'apps/mpeg.c')
-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); | |||
258 | static void resume_recording(void); | 258 | static void resume_recording(void); |
259 | #endif /* (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) */ | 259 | #endif /* (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) */ |
260 | 260 | ||
261 | static void audio_reset_buffer_noalloc(void* buf, size_t bufsize); | ||
262 | static void audio_reset_buffer(void); | ||
263 | |||
261 | 264 | ||
262 | #ifndef SIMULATOR | 265 | #ifndef SIMULATOR |
263 | static int num_tracks_in_memory(void) | 266 | static int num_tracks_in_memory(void) |
@@ -517,7 +520,6 @@ static void do_stop(void) | |||
517 | #endif | 520 | #endif |
518 | } | 521 | } |
519 | 522 | ||
520 | static void audio_reset_buffer_noalloc(void* buf, size_t bufsize); | ||
521 | /* Buffer must not move. */ | 523 | /* Buffer must not move. */ |
522 | static int shrink_callback(int handle, unsigned hints, void* start, size_t old_size) | 524 | static 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(); |