qtdemux: Memory usage is proportional to the time duration of m4a files.
Submitted by lei..@..il.com
Link to original bug (#722639)
Description
QuickTime stores media data in samples. The number of a samples in m4a
files are huge. For example, a 6hr m4a file has about 950,000 samples.
Because qtdemux.c creates a sample table whose size is proportional to
the number of samples, the sample table could be very big. For an m4a file
6:11:46 long, I got:
"qtdemux qtdemux.c:6306:qtdemux_stbl_init:<qtdemux0>
allocating
n_samples 960669 * 32 (29.32 MB)"
Indeed, qtdemux has a cap of 50MB for this table:
/* if the sample index is larger than this, something is likely wrong /
#define QTDEMUX_MAX_SAMPLE_INDEX_SIZE (501024*1024)
The current design has two problems for m4a files:
- m4a files with duration greater than 12hrs won't play:
qtdemux qtdemux.c:6306:qtdemux_stbl_init:<qtdemux0>
allocating
n_samples 1921335 * 32 (58.63 MB)
qtdemux qtdemux.c:6312:qtdemux_stbl_init:<qtdemux0>
not allocating
index of 1921335 samples, would be larger than 50MB (broken file?)
Such a file can be downloaded at: https://dl.dropboxusercontent.com/u/54923483/White_Noise_320kbps_14Hour.m4a
- It may impose a memory burden for embedded systems.
Could somebody take a look at this issue and improve qtdemux?
Discussions of this issue can be found at : http://lists.freedesktop.org/archives/gstreamer-devel/2014-January/045660.html