diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2011-01-25 17:18:20 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2011-01-25 17:18:20 +0000 |
| commit | c498a5cf087f1cb213444ff6f2b5b35df4f3fa18 (patch) | |
| tree | 00c9dbf39d8b6edb66ce12558858b41d36c56f3e | |
| parent | f716e4fdedfc4858aed463428278981ac36be393 (diff) | |
| download | rockbox-c498a5cf087f1cb213444ff6f2b5b35df4f3fa18.zip rockbox-c498a5cf087f1cb213444ff6f2b5b35df4f3fa18.tar.gz rockbox-c498a5cf087f1cb213444ff6f2b5b35df4f3fa18.tar.bz2 rockbox-c498a5cf087f1cb213444ff6f2b5b35df4f3fa18.tar.xz | |
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
| -rw-r--r-- | apps/plugins/mpegplayer/pcm_output.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/plugins/mpegplayer/pcm_output.c b/apps/plugins/mpegplayer/pcm_output.c index 0b8ad77..fb7ff43 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; } |