summaryrefslogtreecommitdiffstats
path: root/apps/playback.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-05-21 02:18:46 -0400
committerMichael Sevakis <jethead71@rockbox.org>2012-05-21 02:28:13 -0400
commit0ebfb937aaa073282415e561f8d1f150813a00fd (patch)
treeace0d47f3ee55c289a4b645986615ff9a281a1df /apps/playback.c
parent5f2618c363467648d96ccbc82e14df7d2194a148 (diff)
downloadrockbox-0ebfb937aaa073282415e561f8d1f150813a00fd.tar.gz
rockbox-0ebfb937aaa073282415e561f8d1f150813a00fd.tar.bz2
rockbox-0ebfb937aaa073282415e561f8d1f150813a00fd.zip
Fix some lockup caused by handles not being initialized to < 0...
...by default where they would be interpreted as valid but not actually be which would cause calls to buffering while it was not initialized. Add BUFFER_EVENT_BUFFER_RESET to inform users of buffering that the buffer is being reinitialized. Basically, this wraps all the functionality being provided by three events (...START_PLAYBACK, RECORDING_EVENT_START, RECORDING_EVENT_STOP) into one for radioart.c, the only user of those events (perhaps remove them?) and closes some loopholes. Change-Id: I99ec46b9b5fb4e36605db5944c60ed986163db3a
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/playback.c b/apps/playback.c
index bd7dd813c9..21cc017aaf 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -3621,6 +3621,9 @@ unsigned char * audio_get_buffer(bool talk_buf, size_t *buffer_size)
audiobuf_handle = core_alloc_maximum("audiobuf", &filebuflen, &ops);
buf = core_get_data(audiobuf_handle);
+ if (buffer_state == AUDIOBUF_STATE_INITIALIZED)
+ buffering_reset(NULL, 0); /* mark buffer invalid */
+
if (talk_buf || buffer_state == AUDIOBUF_STATE_TRASHED
|| !talk_voice_required())
{