summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Artiukhin <bahusdrive@gmail.com>2024-01-24 11:55:48 +0200
committerRoman Artiukhin <bahusdrive@gmail.com>2024-01-24 18:19:33 +0200
commitbe16edc94b9b44da6b83235fab248fa8a31126fb (patch)
treedbe0d387003c71956938f349cd50521334724162
parent1122cae02804bd97887d51be6e5eee6a1616a09b (diff)
downloadrockbox-be16edc94b9b44da6b83235fab248fa8a31126fb.tar.gz
rockbox-be16edc94b9b44da6b83235fab248fa8a31126fb.zip
Codecs: mpa: Use both time and offset when resuming files
The supplied time may be more accurate than the calculated time from the bitrate (can be quite inaccurate for long vbr files and even for cbr due to padding) Change-Id: I1f8291eab45fbd91a161b51776c391a0f7886a5c
-rw-r--r--lib/rbcodec/codecs/mpa.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/rbcodec/codecs/mpa.c b/lib/rbcodec/codecs/mpa.c
index 5fdcb38da8..2c651d11b0 100644
--- a/lib/rbcodec/codecs/mpa.c
+++ b/lib/rbcodec/codecs/mpa.c
@@ -462,7 +462,14 @@ enum codec_status codec_run(void)
462 } 462 }
463 else { 463 else {
464 ci->seek_buffer(ci->id3->offset); 464 ci->seek_buffer(ci->id3->offset);
465 set_elapsed(ci->id3); 465 if (ci->id3->elapsed && ci->id3->elapsed < ci->id3->length)
466 {
467 ci->set_elapsed(ci->id3->elapsed);
468 }
469 else
470 {
471 set_elapsed(ci->id3);
472 }
466 } 473 }
467 } 474 }
468 else if (ci->id3->elapsed) 475 else if (ci->id3->elapsed)