summaryrefslogtreecommitdiffstats
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-be16edc94b.tar.gz
rockbox-be16edc94b.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)
}
else {
ci->seek_buffer(ci->id3->offset);
- set_elapsed(ci->id3);
+ if (ci->id3->elapsed && ci->id3->elapsed < ci->id3->length)
+ {
+ ci->set_elapsed(ci->id3->elapsed);
+ }
+ else
+ {
+ set_elapsed(ci->id3);
+ }
}
}
else if (ci->id3->elapsed)