diff options
-rw-r--r-- | apps/playback.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/apps/playback.c b/apps/playback.c index 9b67f2ccc7..c425e14baf 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -2097,23 +2097,11 @@ static int audio_finish_load_track(struct track_info *infop) | |||
2097 | /** Finally, load the audio **/ | 2097 | /** Finally, load the audio **/ |
2098 | off_t file_offset = 0; | 2098 | off_t file_offset = 0; |
2099 | 2099 | ||
2100 | if (track_id3->elapsed > track_id3->length) | ||
2101 | track_id3->elapsed = 0; | ||
2102 | |||
2103 | if ((off_t)track_id3->offset >= buf_filesize(infop->audio_hid)) | ||
2104 | track_id3->offset = 0; | ||
2105 | |||
2106 | logf("%s: set offset for %s to %lu\n", __func__, | ||
2107 | track_id3->title, track_id3->offset); | ||
2108 | |||
2109 | /* Adjust for resume rewind so we know what to buffer - starting the codec | 2100 | /* Adjust for resume rewind so we know what to buffer - starting the codec |
2110 | calls it again, so we don't save it (and they shouldn't accumulate) */ | 2101 | calls it again, so we don't save it (and they shouldn't accumulate) */ |
2111 | unsigned long elapsed, offset; | 2102 | unsigned long elapsed, offset; |
2112 | resume_rewind_adjust_progress(track_id3, &elapsed, &offset); | 2103 | resume_rewind_adjust_progress(track_id3, &elapsed, &offset); |
2113 | 2104 | ||
2114 | logf("%s: Set resume for %s to %lu %lu", __func__, | ||
2115 | track_id3->title, elapsed, offset); | ||
2116 | |||
2117 | enum data_type audiotype = rbcodec_format_is_atomic(track_id3->codectype) ? | 2105 | enum data_type audiotype = rbcodec_format_is_atomic(track_id3->codectype) ? |
2118 | TYPE_ATOMIC_AUDIO : TYPE_PACKET_AUDIO; | 2106 | TYPE_ATOMIC_AUDIO : TYPE_PACKET_AUDIO; |
2119 | 2107 | ||
@@ -2145,6 +2133,19 @@ static int audio_finish_load_track(struct track_info *infop) | |||
2145 | if (hid >= 0) | 2133 | if (hid >= 0) |
2146 | { | 2134 | { |
2147 | infop->audio_hid = hid; | 2135 | infop->audio_hid = hid; |
2136 | |||
2137 | /* | ||
2138 | * Fix up elapsed time and offset if past the end | ||
2139 | */ | ||
2140 | if (track_id3->elapsed > track_id3->length) | ||
2141 | track_id3->elapsed = 0; | ||
2142 | |||
2143 | if ((off_t)track_id3->offset >= buf_filesize(infop->audio_hid)) | ||
2144 | track_id3->offset = 0; | ||
2145 | |||
2146 | logf("%s: set resume for %s to %lu %lX", __func__, | ||
2147 | track_id3->title, track_id3->elapsed, track_id3->offset); | ||
2148 | |||
2148 | if (infop->self_hid == cur_info.self_hid) | 2149 | if (infop->self_hid == cur_info.self_hid) |
2149 | { | 2150 | { |
2150 | /* This is the current track to decode - should be started now */ | 2151 | /* This is the current track to decode - should be started now */ |