summaryrefslogtreecommitdiff
path: root/apps/codecs/wav64.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/wav64.c')
-rw-r--r--apps/codecs/wav64.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/codecs/wav64.c b/apps/codecs/wav64.c
index 1913dafe5c..c06f78c802 100644
--- a/apps/codecs/wav64.c
+++ b/apps/codecs/wav64.c
@@ -380,10 +380,17 @@ next_track:
380 /* make sure we're at the correct offset */ 380 /* make sure we're at the correct offset */
381 if (bytesdone > (uint32_t) firstblockposn) { 381 if (bytesdone > (uint32_t) firstblockposn) {
382 /* Round down to previous block */ 382 /* Round down to previous block */
383 uint32_t offset = bytesdone - bytesdone % format.blockalign; 383 struct pcm_pos *newpos = codec->get_seek_pos(bytesdone - firstblockposn,
384 PCM_SEEK_POS, &read_buffer);
384 385
385 ci->advance_buffer(offset-firstblockposn); 386 if (newpos->pos > format.numbytes)
386 bytesdone = offset - firstblockposn; 387 goto done;
388 if (ci->seek_buffer(firstblockposn + newpos->pos))
389 {
390 bytesdone = newpos->pos;
391 decodedsamples = newpos->samples;
392 }
393 ci->seek_complete();
387 } else { 394 } else {
388 /* already where we need to be */ 395 /* already where we need to be */
389 bytesdone = 0; 396 bytesdone = 0;
@@ -399,7 +406,8 @@ next_track:
399 } 406 }
400 407
401 if (ci->seek_time) { 408 if (ci->seek_time) {
402 struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, &read_buffer); 409 struct pcm_pos *newpos = codec->get_seek_pos(ci->seek_time, PCM_SEEK_TIME,
410 &read_buffer);
403 411
404 if (newpos->pos > format.numbytes) 412 if (newpos->pos > format.numbytes)
405 break; 413 break;