diff options
Diffstat (limited to 'lib/rbcodec/codecs/a52_rm.c')
-rw-r--r-- | lib/rbcodec/codecs/a52_rm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/rbcodec/codecs/a52_rm.c b/lib/rbcodec/codecs/a52_rm.c index 42868437d8..3f07a43ce9 100644 --- a/lib/rbcodec/codecs/a52_rm.c +++ b/lib/rbcodec/codecs/a52_rm.c | |||
@@ -148,13 +148,15 @@ enum codec_status codec_run(void) | |||
148 | int consumed, packet_offset; | 148 | int consumed, packet_offset; |
149 | int playback_on = -1; | 149 | int playback_on = -1; |
150 | size_t resume_offset; | 150 | size_t resume_offset; |
151 | enum codec_command_action action; | ||
151 | intptr_t param; | 152 | intptr_t param; |
152 | enum codec_command_action action = CODEC_ACTION_NULL; | ||
153 | 153 | ||
154 | if (codec_init()) { | 154 | if (codec_init()) { |
155 | return CODEC_ERROR; | 155 | return CODEC_ERROR; |
156 | } | 156 | } |
157 | 157 | ||
158 | action = CODEC_ACTION_NULL; | ||
159 | param = ci->id3->elapsed; | ||
158 | resume_offset = ci->id3->offset; | 160 | resume_offset = ci->id3->offset; |
159 | 161 | ||
160 | ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); | 162 | ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); |
@@ -171,11 +173,14 @@ enum codec_status codec_run(void) | |||
171 | samplesdone = 0; | 173 | samplesdone = 0; |
172 | 174 | ||
173 | /* check for a mid-track resume and force a seek time accordingly */ | 175 | /* check for a mid-track resume and force a seek time accordingly */ |
174 | if(resume_offset > rmctx.data_offset + DATA_HEADER_SIZE) { | 176 | if (resume_offset) { |
175 | resume_offset -= rmctx.data_offset + DATA_HEADER_SIZE; | 177 | resume_offset -= MIN(resume_offset, rmctx.data_offset + DATA_HEADER_SIZE); |
176 | /* put number of subpackets to skip in resume_offset */ | 178 | /* put number of subpackets to skip in resume_offset */ |
177 | resume_offset /= (rmctx.block_align + PACKET_HEADER_SIZE); | 179 | resume_offset /= (rmctx.block_align + PACKET_HEADER_SIZE); |
178 | param = (int)resume_offset * ((rmctx.block_align * 8 * 1000)/rmctx.bit_rate); | 180 | param = (int)resume_offset * ((rmctx.block_align * 8 * 1000)/rmctx.bit_rate); |
181 | } | ||
182 | |||
183 | if (param > 0) { | ||
179 | action = CODEC_ACTION_SEEK_TIME; | 184 | action = CODEC_ACTION_SEEK_TIME; |
180 | } | 185 | } |
181 | else { | 186 | else { |