GNOME Bugzilla – Bug 770678
qtdemux: Not considering sample size when calculating size of chunk.
Last modified: 2018-11-03 15:11:18 UTC
The size of chunk is not taking into account the size of samples. Some mp4 files have stream->sample_size != 1. When this occurs they will not play audio. If stream->sample_size is 1 the current code works. What I'm proposing is a change here to lines: 7799/7800 if (stream->samples_per_frame * stream->bytes_per_frame) { cur->size = - (stream->samples_per_chunk * stream->n_channels) / - stream->samples_per_frame * stream->bytes_per_frame; + ((stream->samples_per_chunk * stream->n_channels) / + stream->samples_per_frame) * stream->bytes_per_frame * stream->sample_size; } else { cur->size = stream->samples_per_chunk; }
Could you make such a file available for us by any chance? (If it's <1MB you can also attach it here.)
I don't have a small clip available unfortunately. Here is a dropbox link to an example clip: https://www.dropbox.com/s/bo35zh41abqowmm/CISCO.zip?dl=0
Has anyone else been able to verify this should fix the issue and introduce other bugs? Thanks, Wes
Created attachment 344278 [details] stsz sample size is 1
Created attachment 344279 [details] Does not work when sample size is 640
Created attachment 344280 [details] [review] Patch to fix issues when stream->sample_size is not one. Patch for qtdemux on version 1.10.2 lets you play sections that do not have sample size of 1.
Review of attachment 344280 [details] [review]: ::: gst/isomp4/qtdemux.c @@ +8299,3 @@ cur->size = (stream->samples_per_chunk * stream->n_channels) / + stream->samples_per_frame * stream->bytes_per_frame * stream->sample_size; This looks correct (but might need some care to prevent overflows?) @@ +8314,3 @@ cur++; + stream->stco_sample_index += stream->samples_per_chunk * stream->sample_size; But this seems not obviously correct at least. Why would the sample_index take the sample_size into account? Shouldn't that just take the number of samples?
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/295.