From 9ff373cb6574675b9ae03c92d604b7ae87e39156 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Fri, 10 Jun 2005 20:29:35 +0000 Subject: [PATCH] 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 --- apps/playback.c | 6 ++++-- firmware/pcm_playback.c | 4 +--- 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) while ((int)*realsize > cur_ti->available) { yield(); if (ci.stop_codec) { + *realsize = 0; return NULL; } } @@ -286,7 +287,7 @@ void codec_advance_buffer_callback(size_t amount) codecbufused = 0; buf_ridx = buf_widx; cur_ti->available = 0; - while ((int)amount < cur_ti->available) + while ((int)amount < cur_ti->available && !ci.stop_codec) yield(); } else { cur_ti->available -= amount; @@ -427,7 +428,8 @@ void yield_codecs(void) #ifndef SIMULATOR if (!pcm_is_playing()) sleep(5); - while (pcm_is_lowdata()) + while (pcm_is_lowdata() && !ci.stop_codec && + playing && queue_empty(&audio_queue)) yield(); #else 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) void pcm_play_pause(bool play) { + pcm_paused = !play; if(pcm_paused && play && pcmbuf_unplayed_bytes) { /* Enable the FIFO and force one write to it */ IIS2CONFIG = (pcm_freq << 12) | 0x300; DCR0 |= DMA_START; - - pcm_paused = false; } else if(!pcm_paused && !play) { IIS2CONFIG = 0x800; - pcm_paused = true; } pcm_boost(false); }