forked from len0rd/rockbox
Don't keep useless id3v2 or other leading tag data on the buffer, it could be large
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15465 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6be390f210
commit
d02b5c744e
4 changed files with 10 additions and 9 deletions
|
|
@ -563,12 +563,12 @@ static bool buffer_handle(int handle_id)
|
||||||
/* This would read into the next handle, this is broken */
|
/* This would read into the next handle, this is broken */
|
||||||
if (h->next && RINGBUF_ADD_CROSS(h->widx, copy_n,
|
if (h->next && RINGBUF_ADD_CROSS(h->widx, copy_n,
|
||||||
(unsigned)((void *)h->next - (void *)buffer)) > 0) {
|
(unsigned)((void *)h->next - (void *)buffer)) > 0) {
|
||||||
logf("Handle allocation short");
|
|
||||||
/* Try to recover by truncating this file */
|
/* Try to recover by truncating this file */
|
||||||
int overlap = RINGBUF_ADD_CROSS(h->widx, copy_n,
|
copy_n = RINGBUF_ADD_CROSS(h->widx, copy_n,
|
||||||
(unsigned)((void *)h->next - (void *)buffer));
|
(unsigned)((void *)h->next - (void *)buffer));
|
||||||
h->filerem -= overlap;
|
h->filerem -= copy_n;
|
||||||
h->filesize -= overlap;
|
h->filesize -= copy_n;
|
||||||
|
logf("buf alloc short %ld",copy_n);
|
||||||
if (h->filerem)
|
if (h->filerem)
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,7 @@ next_track:
|
||||||
current_frequency = ci->id3->frequency;
|
current_frequency = ci->id3->frequency;
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
ci->request_buffer(&size, ci->id3->first_frame_offset);
|
ci->seek_buffer(ci->id3->first_frame_offset);
|
||||||
ci->advance_buffer(size);
|
|
||||||
|
|
||||||
if (ci->id3->lead_trim >= 0 && ci->id3->tail_trim >= 0) {
|
if (ci->id3->lead_trim >= 0 && ci->id3->tail_trim >= 0) {
|
||||||
stop_skip = ci->id3->tail_trim - mpeg_latency[ci->id3->layer];
|
stop_skip = ci->id3->tail_trim - mpeg_latency[ci->id3->layer];
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,7 @@ next_track:
|
||||||
|
|
||||||
/* Skip id3v2 tags */
|
/* Skip id3v2 tags */
|
||||||
if (ci->id3->first_frame_offset) {
|
if (ci->id3->first_frame_offset) {
|
||||||
buf = ci->request_buffer(&bytesleft, ci->id3->first_frame_offset);
|
ci->seek_buffer(ci->id3->first_frame_offset);
|
||||||
ci->advance_buffer(ci->id3->first_frame_offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the shorten & wave headers */
|
/* Read the shorten & wave headers */
|
||||||
|
|
|
||||||
|
|
@ -1803,7 +1803,7 @@ static bool codec_request_next_track_callback(void)
|
||||||
/* Seek to the beginning of the new track because if the struct mp3entry was
|
/* Seek to the beginning of the new track because if the struct mp3entry was
|
||||||
buffered, "elapsed" might not be zero (if the track has been played
|
buffered, "elapsed" might not be zero (if the track has been played
|
||||||
already but not unbuffered) */
|
already but not unbuffered) */
|
||||||
codec_seek_buffer_callback(0);
|
codec_seek_buffer_callback(curtrack_id3.first_frame_offset);
|
||||||
|
|
||||||
/* Check if the next codec is the same file. */
|
/* Check if the next codec is the same file. */
|
||||||
if (prev_codectype == get_codec_base_type(curtrack_id3.codectype))
|
if (prev_codectype == get_codec_base_type(curtrack_id3.codectype))
|
||||||
|
|
@ -2441,6 +2441,9 @@ static bool audio_load_track(int offset, bool start_play)
|
||||||
|
|
||||||
logf("alt:%s", trackname);
|
logf("alt:%s", trackname);
|
||||||
|
|
||||||
|
if (!file_offset && track_id3->first_frame_offset)
|
||||||
|
file_offset = track_id3->first_frame_offset;
|
||||||
|
|
||||||
tracks[track_widx].audio_hid = bufopen(trackname, file_offset, type);
|
tracks[track_widx].audio_hid = bufopen(trackname, file_offset, type);
|
||||||
|
|
||||||
if (tracks[track_widx].audio_hid < 0)
|
if (tracks[track_widx].audio_hid < 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue