mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-17 00:52:38 -05:00
Codecs: mp4: Re-Fix loading tracks with metadata at the end of file
first_frame_offset is not set for mp4 files so seeking to it doesn't make any sense. It can lead only to additional re-buffer request. So instead let's just allow seek back for m4a_check_sample_offset check. And do seek_buffer(0) before reading metadata (fixes possible hang introduced in fc65bdab)
Change-Id: Ia7fae14b0137d73b5e263390be5f143deb7ca789
This commit is contained in:
parent
de16065265
commit
3080892d21
1 changed files with 6 additions and 4 deletions
|
|
@ -92,6 +92,8 @@ enum codec_status codec_run(void)
|
||||||
|
|
||||||
stream_create(&input_stream,ci);
|
stream_create(&input_stream,ci);
|
||||||
|
|
||||||
|
ci->seek_buffer(0);
|
||||||
|
|
||||||
/* if qtmovie_read returns successfully, the stream is up to
|
/* if qtmovie_read returns successfully, the stream is up to
|
||||||
* the movie data, which can be used directly by the decoder */
|
* the movie data, which can be used directly by the decoder */
|
||||||
if (!qtmovie_read(&input_stream, &demux_res)) {
|
if (!qtmovie_read(&input_stream, &demux_res)) {
|
||||||
|
|
@ -146,7 +148,6 @@ enum codec_status codec_run(void)
|
||||||
} else {
|
} else {
|
||||||
elapsed_time = 0;
|
elapsed_time = 0;
|
||||||
sound_samples_done = 0;
|
sound_samples_done = 0;
|
||||||
ci->seek_buffer(ci->id3->first_frame_offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->set_elapsed(elapsed_time);
|
ci->set_elapsed(elapsed_time);
|
||||||
|
|
@ -194,13 +195,14 @@ enum codec_status codec_run(void)
|
||||||
* doesn't seem to happen much, but it probably means that a
|
* doesn't seem to happen much, but it probably means that a
|
||||||
* "proper" file can have chunks out of order. Why one would want
|
* "proper" file can have chunks out of order. Why one would want
|
||||||
* that an good question (but files with gaps do exist, so who
|
* that an good question (but files with gaps do exist, so who
|
||||||
* knows?), so we don't support that - for now, at least.
|
* knows?), and we might not properly support it.
|
||||||
|
* Metadata can also be placed after audio data so skip back if needed.
|
||||||
*/
|
*/
|
||||||
file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx);
|
file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx);
|
||||||
|
|
||||||
if (file_offset > ci->curpos)
|
if (file_offset > 0 && file_offset != ci->curpos)
|
||||||
{
|
{
|
||||||
ci->advance_buffer(file_offset - ci->curpos);
|
ci->seek_buffer(file_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Request the required number of bytes from the input buffer */
|
/* Request the required number of bytes from the input buffer */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue