forked from len0rd/rockbox
Fixed the dreaded 'silent play' bug
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3541 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
434b7d90ed
commit
35c417f1d4
1 changed files with 15 additions and 7 deletions
|
@ -1239,7 +1239,7 @@ static bool swap_one_chunk(void)
|
|||
else
|
||||
amount_to_swap = MIN(mp3buf_write - mp3buf_swapwrite,
|
||||
amount_to_swap);
|
||||
|
||||
|
||||
bitswap(mp3buf + mp3buf_swapwrite, amount_to_swap);
|
||||
|
||||
mp3buf_swapwrite += amount_to_swap;
|
||||
|
@ -1583,7 +1583,7 @@ static void mpeg_thread(void)
|
|||
int unplayed_space_left, unswapped_space_left;
|
||||
|
||||
/* We are changing to a position that's already in
|
||||
memory */
|
||||
memory, so we just move the DMA read pointer. */
|
||||
mp3buf_read = mp3buf_write - diffpos;
|
||||
if (mp3buf_read < 0)
|
||||
{
|
||||
|
@ -1593,6 +1593,19 @@ static void mpeg_thread(void)
|
|||
unplayed_space_left = get_unplayed_space();
|
||||
unswapped_space_left = get_unswapped_space();
|
||||
|
||||
/* If unswapped_space_left is larger than
|
||||
unplayed_space_left, it means that the swapwrite pointer
|
||||
hasn't yet advanced up to the new location of the read
|
||||
pointer. We just move it, there is no need to swap
|
||||
data that won't be played anyway. */
|
||||
|
||||
if (unswapped_space_left > unplayed_space_left)
|
||||
{
|
||||
DEBUGF("Moved swapwrite\n");
|
||||
mp3buf_swapwrite = mp3buf_read;
|
||||
play_pending = true;
|
||||
}
|
||||
|
||||
if (mpeg_file>=0 && unplayed_space_left < low_watermark)
|
||||
{
|
||||
/* We need to load more data before starting */
|
||||
|
@ -1600,11 +1613,6 @@ static void mpeg_thread(void)
|
|||
queue_post(&mpeg_queue, MPEG_NEED_DATA, 0);
|
||||
play_pending = true;
|
||||
}
|
||||
else if (unswapped_space_left > unplayed_space_left)
|
||||
{
|
||||
mp3buf_swapwrite = mp3buf_read;
|
||||
play_pending = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* resume will start at new position */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue