summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-11-14 19:43:17 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-11-16 06:48:22 -0500
commitea61347a0b10154f0b346ae8de013b13cd19dd8a (patch)
treea95dd1e0bd8e90b546d878c0461008d6f3cb98f9
parent5fdd491ceb6a440403cbf97eb33d6dcc80be31a8 (diff)
downloadrockbox-ea61347a0b10154f0b346ae8de013b13cd19dd8a.tar.gz
rockbox-ea61347a0b10154f0b346ae8de013b13cd19dd8a.zip
codecs: aac: Prefer to resume by time instead of offset
m4a_seek_raw() is relatively inaccurate, so time-based resume should be preferred. Change-Id: I959ef165f9a99d12deb804c13d20413c1cecf867
-rw-r--r--lib/rbcodec/codecs/aac.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/rbcodec/codecs/aac.c b/lib/rbcodec/codecs/aac.c
index c00946f227..b470fd9622 100644
--- a/lib/rbcodec/codecs/aac.c
+++ b/lib/rbcodec/codecs/aac.c
@@ -130,9 +130,12 @@ enum codec_status codec_run(void)
130 130
131 i = 0; 131 i = 0;
132 132
133 if (file_offset > 0) { 133 if (param) {
134 elapsed_time = param;
135 action = CODEC_ACTION_SEEK_TIME;
136 } else if (file_offset > 0) {
134 /* Resume the desired (byte) position. Important: When resuming SBR 137 /* Resume the desired (byte) position. Important: When resuming SBR
135 * upsampling files the resulting sound_samples_done must be expanded 138 * upsampling files the resulting sound_samples_done must be expanded
136 * by a factor of 2. This is done via using sbr_fac. */ 139 * by a factor of 2. This is done via using sbr_fac. */
137 if (m4a_seek_raw(&demux_res, &input_stream, file_offset, 140 if (m4a_seek_raw(&demux_res, &input_stream, file_offset,
138 &sound_samples_done, (int*) &i)) { 141 &sound_samples_done, (int*) &i)) {
@@ -142,9 +145,6 @@ enum codec_status codec_run(void)
142 } 145 }
143 NeAACDecPostSeekReset(decoder, i); 146 NeAACDecPostSeekReset(decoder, i);
144 elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency; 147 elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency;
145 } else if (param) {
146 elapsed_time = param;
147 action = CODEC_ACTION_SEEK_TIME;
148 } else { 148 } else {
149 elapsed_time = 0; 149 elapsed_time = 0;
150 sound_samples_done = 0; 150 sound_samples_done = 0;