summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-06-10 20:29:35 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-06-10 20:29:35 +0000
commit9ff373cb6574675b9ae03c92d604b7ae87e39156 (patch)
tree5feef24a8452579f1089467f328b678b92642c77
parent7e0b6880d9cfb5d4a528e2de091eb3b307beca2f (diff)
downloadrockbox-9ff373cb6574675b9ae03c92d604b7ae87e39156.tar.gz
rockbox-9ff373cb6574675b9ae03c92d604b7ae87e39156.zip
Fixed a null pointer problem which caused crashing. Playback should be
now more stable. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6660 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c6
-rw-r--r--firmware/pcm_playback.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/apps/playback.c b/apps/playback.c
index a804103006..3e046fad6c 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -261,6 +261,7 @@ void* codec_request_buffer_callback(size_t *realsize, size_t reqsize)
261 while ((int)*realsize > cur_ti->available) { 261 while ((int)*realsize > cur_ti->available) {
262 yield(); 262 yield();
263 if (ci.stop_codec) { 263 if (ci.stop_codec) {
264 *realsize = 0;
264 return NULL; 265 return NULL;
265 } 266 }
266 } 267 }
@@ -286,7 +287,7 @@ void codec_advance_buffer_callback(size_t amount)
286 codecbufused = 0; 287 codecbufused = 0;
287 buf_ridx = buf_widx; 288 buf_ridx = buf_widx;
288 cur_ti->available = 0; 289 cur_ti->available = 0;
289 while ((int)amount < cur_ti->available) 290 while ((int)amount < cur_ti->available && !ci.stop_codec)
290 yield(); 291 yield();
291 } else { 292 } else {
292 cur_ti->available -= amount; 293 cur_ti->available -= amount;
@@ -427,7 +428,8 @@ void yield_codecs(void)
427#ifndef SIMULATOR 428#ifndef SIMULATOR
428 if (!pcm_is_playing()) 429 if (!pcm_is_playing())
429 sleep(5); 430 sleep(5);
430 while (pcm_is_lowdata()) 431 while (pcm_is_lowdata() && !ci.stop_codec &&
432 playing && queue_empty(&audio_queue))
431 yield(); 433 yield();
432#else 434#else
433 yield(); 435 yield();
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index a4978d645b..50b675734b 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -240,18 +240,16 @@ void pcm_play_stop(void)
240 240
241void pcm_play_pause(bool play) 241void pcm_play_pause(bool play)
242{ 242{
243 pcm_paused = !play;
243 if(pcm_paused && play && pcmbuf_unplayed_bytes) 244 if(pcm_paused && play && pcmbuf_unplayed_bytes)
244 { 245 {
245 /* Enable the FIFO and force one write to it */ 246 /* Enable the FIFO and force one write to it */
246 IIS2CONFIG = (pcm_freq << 12) | 0x300; 247 IIS2CONFIG = (pcm_freq << 12) | 0x300;
247 DCR0 |= DMA_START; 248 DCR0 |= DMA_START;
248
249 pcm_paused = false;
250 } 249 }
251 else if(!pcm_paused && !play) 250 else if(!pcm_paused && !play)
252 { 251 {
253 IIS2CONFIG = 0x800; 252 IIS2CONFIG = 0x800;
254 pcm_paused = true;
255 } 253 }
256 pcm_boost(false); 254 pcm_boost(false);
257} 255}