summaryrefslogtreecommitdiff
path: root/apps/codecs/wav.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/wav.c')
-rw-r--r--apps/codecs/wav.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c
index d9be0a3..f83f1d1 100644
--- a/apps/codecs/wav.c
+++ b/apps/codecs/wav.c
@@ -410,11 +410,19 @@ next_track:
}
firstblockposn = 1024 - n;
- ci->advance_buffer(firstblockposn);
+
+ if (ci->id3->offset > (uint32_t) firstblockposn) {
+ /* Round down to previous block */
+ uint32_t offset = ci->id3->offset - ci->id3->offset % blockalign;
+
+ ci->advance_buffer(offset);
+ bytesdone = offset - firstblockposn;
+ } else {
+ ci->advance_buffer(firstblockposn);
+ bytesdone = 0;
+ }
/* The main decoder loop */
- bytesdone = 0;
- ci->set_elapsed(0);
endofstream = 0;
/* chunksize is computed so that one chunk is about 1/50s.
* this make 4096 for 44.1kHz 16bits stereo.