This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#8923 - m4a playback bugs
Attached to Project:
Rockbox
Opened by Paul D (paschadee) - Monday, 21 April 2008, 16:51 GMT+2
Last edited by Andree Buschmann (Buschel) - Monday, 18 April 2011, 21:17 GMT+2
Opened by Paul D (paschadee) - Monday, 21 April 2008, 16:51 GMT+2
Last edited by Andree Buschmann (Buschel) - Monday, 18 April 2011, 21:17 GMT+2
|
Detailsbeen using rockbox for years, but recently m4a playback has become more frequent as i encode more with it.
-long mixes e.g. 1hr dont load well (long wait times with the DB switched off) -dont resume at all, sometimes. system crash if system restart and resumes playback in said mixes. -Somewhere between 1 and two hours long or greater length continuous mixes in m4a simply don't load at all. -bookmarks or resumed playback in extremely low bitrate files e.g. 40kbps doesn't resume correctly or at all in those files. For reference, I use winamps 'format converter' plugin --> MP4/LC-AAC can document more if need be. |
This task depends upon
Closed by Andree Buschmann (Buschel)
Monday, 18 April 2011, 21:17 GMT+2
Reason for closing: Fixed
Additional comments about closing: Finally fixed with r29745.
Monday, 18 April 2011, 21:17 GMT+2
Reason for closing: Fixed
Additional comments about closing: Finally fixed with r29745.
The attached patch reduces the size of chunk_offset[] by a factor of 8. This works for most of my files. All files with num_sample_to_chunks>2 do not work. This patch does not check for this and will -- in this state -- not play such file.
Main problem for future work in this area is that our codecs (e.g. aac.c) call get_sample_offset() _each_ frame. When this is removed most files do not play anymore... As long as we need this we cannot drop the precision of the array that is interesting for memory consuption (sample_byte_size[]).
Note: The patch has still several printf()'s in there.
One way to solve this could be to covert the seek tables to "byte-offset, num-frames" entries (and time offset, if needed), making sure that no entry "spans" a chunk gap. Also, it'd be nice to do this during buffering. Haven't done much coding along these lines though, as dealing with the MP4 seek tables isn't particularly fun, IMO. :)
Idea: Only save special entries for those frames. The entry contains "frame idx" and "next byte pos" (or "bytes to skip"). Instead of reconstructing the byte offset with get_sample_offset() each time we can then check whether we can simply use frame_info.bytesconsumed or need to read from the "special case" array. This check is done via checking if the current frame has an entry in this table. I would expect that such table would be much smaller than the current ones. Such table would need uint32 for "frame idx" and uint16 for "bytes to skip" per entry.
Disadvantage: This might require searching for a match of current frame to the "frame idx" over large arrays in case we need such table.
My idea is to decode numframes frames using frameinfo.bytesconsumed to advance the read offset, then seek to the next offset if needed. No special cases or long arrays to check during decode. Also, the entire frame size table wouldn't be needed then (usually the biggest table). 5-10,000 seek entries should give good enough seek resolution, I think.
FS#11991as a duplicate. In it I reported that I could not play back the following files on my ClipV2 (with various revisions between r28308 and r29506):http://www.club-autonomic.com/podcast/autonomic_podcast_layer_11.m4a
http://www.club-autonomic.com/podcast/autonomic_podcast_layer_12.m4a
Buschel and saratoga commented that these files' TOC/seek table won't fit into the decoder's RAM, and Buschel pointed to this task for a discussion of how to fix this problem.
ffmpeg -i download.flv -vn -acodec copy raw.aac
MP4Box -new -add raw.aac -split 3600 outfile.mp4
Which generates outfile_001.mp4, outfile_002.mp4 and so on until it runs out of file. Said files play nicely (and gaplessly!) in Rockbox. If they are too big for lower-memory players, the 3600 is the file length in seconds, which could be lowered down to 1800 for 30 mins and so on.
Hope this helps if getting the playback fixed properly is going to take a while!
For the record this is MP4Box from GPac 0.4.5-r2 and FFmpeg 0.6_p25767, both from Gentoo on amd64
For now the size of m4a_sync_tab[][] is fixed and the build-up is done after allocating and reading sample_byte_size[]. To be able to reduce the memory consumption it is needed to build up m4a_sync_tab[][] *instead* sample_byte_size[]. For the seek functionality we are then able to allocate and build up sample_byte_size[] with a far smaller resolution (e.g. not for each frame, but for each 10th frame).
Savings for some of my samples here (measured is malloc-usage in Byte):
sample / svn / v10
autonomic / 826.236 / 560.452
nrj / 118.260 / 116.140
radiozu / 142.484 / 139.644
Schubdüse / 700.312 / 190.108 (!)
twip_002 / 338.948 / 224.348
twip_003 / 561.952 / 370.880
The savings for the samples files from above:
sample / svn / v11
autonomic / 826.236 / 450.360 (!) -> duration 1:34h
nrj / 118.260 / 115.528 -> duration 1:11m
radiozu / 142.484 / 138.692 -> duration 1:50m
Schubdüse / 700.312 / 130.080 (!) -> duration 2:02h
twip_002 / 338.948 / 181.480 (!) -> duration 38:45m
twip_003 / 561.952 / 298.704 (!) -> duration 1:05h
As expected the files with long duration will benefit a lot.
Next steps:
- Speed up building up the lookup table.
sample / svn / v16 / v17
autonomic / 8s / 7s / 5s
Schubdüse / 6s / 6s / 4s
twip_002 / 4s / 4s / 3s
twip_003 / 5s / 6s / 4s
I might submit the changes in aac/alac decoder independently.
I'm not sure what you mean with your 5 s measurement from select to playback – on my ClipV2 the files start almost instantly.
The 5s were measured on my iPod Video. It needs ~2-3s for disc spinup and has a slower CPU. On Your ClipV2 I would expect to only have max. 1-2s before playback starts.