From 16e339d087157e518b478427a5d79f8c4a8ff0c6 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 29 Jun 2009 19:24:48 +0000 Subject: Bugfix for FS#10157 - "inaccurate seeking while paused" by Jeffrey Goode. The pcmbuffer wasn't reset after subsequent seeks (i.e. all but the first one) when seeking while paused. This caused the buffer to be filled only once and so the wrong sound was played upon resuming. Now we make sure the pcmbuffer is always reset when not playing (a more detailed explaination is in the task). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21570 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'apps') diff --git a/apps/playback.c b/apps/playback.c index 65d7fbe204..4af457cd44 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -1098,13 +1098,19 @@ static void codec_advance_buffer_loc_callback(void *ptr) static void codec_seek_complete_callback(void) { logf("seek_complete"); - if (pcm_is_paused()) - { - /* If this is not a seamless seek, clear the buffer */ + /* If seeking-while-playing, pcm playback is actually paused (pcm_is_paused()) + * but the paused flag is not set. If seeking-while-paused, the (paused) flag is + * set, but pcm playback may have actually stopped due to a previous buffer clear. + * The buffer clear below occurs with either condition. A seemless seek skips + * this section and no buffer clear occurs. + */ + if (pcm_is_paused() || paused) + { + /* Clear the buffer */ pcmbuf_play_stop(); dsp_configure(ci.dsp, DSP_FLUSH, 0); - /* If playback was not 'deliberately' paused, unpause now */ + /* If seeking-while-playing, resume pcm playback */ if (!paused) pcmbuf_pause(false); } -- cgit v1.2.3