From 7ad2cad173ffa094bb285112582afee1c9aea4e5 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 28 Aug 2011 07:45:35 +0000 Subject: Commit work started in FS#12153 to put timing/position information in PCM buffer chunks. * Samples and position indication is closely associated with audio data instead of compensating by a latency constant. Alleviates problems with using the elapsed as a track indicator where it could be off by several steps. * Timing is accurate throughout track even if resampling for pitch shift, whereas before it updated during transition latency at the normal 1:1 rate. * Simpler PCM buffer with a constant chunk size, no linked lists. In converting crossfade, a minor change was made to not change the WPS until the fade-in of the incoming track, whereas before it would change upon the start of the fade-out of the outgoing track possibly having the WPS change with far too much lead time. Codec changes are to set elapsed times *before* writing next PCM frame because time and position data last set are saved in the next committed PCM chunk. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30366 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/aac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apps/codecs/aac.c') diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c index 52e08c7b56..f1e81bad81 100644 --- a/apps/codecs/aac.c +++ b/apps/codecs/aac.c @@ -134,8 +134,6 @@ enum codec_status codec_run(void) if (m4a_seek_raw(&demux_res, &input_stream, file_offset, &sound_samples_done, (int*) &i)) { sound_samples_done *= sbr_fac; - elapsed_time = (sound_samples_done * 10) / (ci->id3->frequency / 100); - ci->set_elapsed(elapsed_time); } else { sound_samples_done = 0; } @@ -143,6 +141,9 @@ enum codec_status codec_run(void) } else { sound_samples_done = 0; } + + elapsed_time = (sound_samples_done * 10) / (ci->id3->frequency / 100); + ci->set_elapsed(elapsed_time); if (i == 0) { -- cgit v1.2.3