GNOME Bugzilla – Bug 743407
qtdemux: doesn't ignore data after last sample in mdat.
Last modified: 2015-02-03 14:00:09 UTC
If qtdemux is demuxing a fragmented stream (e.g., a DASH stream), and it receives a fragment that contains data in its mdat after the end of the last sample, playback fails. The reason is that qtdemux will start trying to parse the next fragment starting from the byte following the end of the last sample (i.e., while still inside the current fragment's mdat) rather than discarding the remaining bytes in the mdat and starting parsing from the beginning of the next fragment. At that point playback fails, since the bytes after the last sample won't be valid ISOBMFF boxes. This can be demonstrated by playing this DASH stream: gst-launch-1.0 playbin uri=http://rdmedia.bbc.co.uk/dash/ondemand/testcard/1/client_manifest-nosurround-ctv.mpd Some of the audio fragments in this stream have "watermarks" in them; the watermark consists of some data inserted in their mdat after the end of the last sample. When the client reaches one of these segments (which on my system happens when playback reaches roughly 1m 29s), it throws an error and exits: ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux1: This file is invalid and cannot be played. Additional debug info: qtdemux.c(5045): gst_qtdemux_process_adapter (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux1: atom RD Execution ended after 0:01:29.561894521 The ISOBMFF spec allows data other than sample data to be carried in an mdat; the demuxer should extract only the sample data that is referenced by metadata in the fragment's moof box.
Created attachment 295282 [details] [review] Throw away non-sample data at end of mdat. This patch fixes the problem for the DASH case, in which the ISOBMFF fragments contain only one track, but it may need to be "generalized" to handle fragments that contain more than one track.
Created attachment 295480 [details] [review] qtdemux: Fix data dropping for fragmented streams Thanks for the detailed report and sample. The bug was actually caused by a missing data skipping operation when qtdemux detects it is out of samples. Please check if this patch solves your issue.
Review of attachment 295480 [details] [review]: Seems correct to me and fixes the reported issue, OK
That fixes it for me - thanks.
Thanks for confirming. commit 2586a219f65e0cb56178e1b50fedeb180b816ecf Author: Thiago Santos <thiagoss@osg.samsung.com> Date: Mon Jan 26 17:08:12 2015 -0300 qtdemux: Fix data dropping for fragmented streams For fragmented streams with extra data at the end of the mdat qtdemux was not dropping those bytes and would try to use that extra data as the beginning of a new atom, causing the stream to fail. https://bugzilla.gnome.org/show_bug.cgi?id=743407