MPEGPlayer: Account for drivers that pass pointers to their internal state variables to the audio callback.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29135 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f716e4fded
commit
c498a5cf08
1 changed files with 7 additions and 6 deletions
|
@ -127,20 +127,21 @@ static void get_more(unsigned char **start, size_t *size)
|
|||
else if (offset < 100*CLOCK_RATE/1000)
|
||||
{
|
||||
/* Frame less than 100ms early - play it */
|
||||
*start = pcmbuf_head->data;
|
||||
struct pcm_frame_header *head = pcmbuf_head;
|
||||
|
||||
pcm_advance_buffer(&pcmbuf_head, sz);
|
||||
pcmbuf_curr_size = sz;
|
||||
|
||||
sz -= PCM_HDR_SIZE;
|
||||
|
||||
*size = sz;
|
||||
|
||||
/* Audio is time master - keep clock synchronized */
|
||||
clock_time = time + (sz >> 2);
|
||||
|
||||
/* Update base clock */
|
||||
clock_tick += sz >> 2;
|
||||
|
||||
*start = head->data;
|
||||
*size = sz;
|
||||
return;
|
||||
}
|
||||
/* Frame will be dropped - play silence clip */
|
||||
|
@ -157,12 +158,12 @@ static void get_more(unsigned char **start, size_t *size)
|
|||
}
|
||||
|
||||
/* Keep clock going at all times */
|
||||
clock_time += sizeof (silence) / 4;
|
||||
clock_tick += sizeof (silence) / 4;
|
||||
|
||||
*start = (unsigned char *)silence;
|
||||
*size = sizeof (silence);
|
||||
|
||||
clock_tick += sizeof (silence) / 4;
|
||||
clock_time += sizeof (silence) / 4;
|
||||
|
||||
if (sz < 0)
|
||||
pcmbuf_read = pcmbuf_written;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue