From c498a5cf087f1cb213444ff6f2b5b35df4f3fa18 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Tue, 25 Jan 2011 17:18:20 +0000 Subject: 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 --- apps/plugins/mpegplayer/pcm_output.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'apps/plugins/mpegplayer/pcm_output.c') diff --git a/apps/plugins/mpegplayer/pcm_output.c b/apps/plugins/mpegplayer/pcm_output.c index 0b8ad7701a..fb7ff434aa 100644 --- a/apps/plugins/mpegplayer/pcm_output.c +++ b/apps/plugins/mpegplayer/pcm_output.c @@ -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; } -- cgit v1.2.3