qtmux: Make sure to write 64-bit STCO table when needed.
authorJan Schmidt <jan@centricular.com>
Thu, 29 Apr 2021 22:12:47 +0000 (08:12 +1000)
committerJan Schmidt <jan@centricular.com>
Thu, 29 Apr 2021 22:12:47 +0000 (08:12 +1000)
commit7c5f2185a97f4a8bec22d7355e1480816fcfeca2
tree2892a61992cb4025dee925fa0cfe6dc5098da2f0
parent5e932395a4ad3e4dde953fce09d611bfe7da5ba0
qtmux: Make sure to write 64-bit STCO table when needed.

qtmux attempts to choose between writing a 32-bit stco chunk offset table
when it can, but switch to a 64-bit co64 table when file offsets go over
4GB.

This patch fixes a problem where the atom handling code was checking
mdat-relative offsets instead of the final file offset (computed by
adding the mdat position plus the mdat-relative offset) - leading to
problems where files with a size between 4GB and 4GB+offset-of-the-mdat
would write incorrect STCO tables with some samples having truncated
32-bit offsets.

Smaller files write STCO correctly, larger files would switch to
co64 and also output correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/970>
gst/isomp4/atoms.c
gst/isomp4/atoms.h