GNOME Bugzilla – Bug 761787
qtdemux: seek fails with CENC encrypted streams
Last modified: 2016-04-21 20:22:29 UTC
When playing a stream that has been protected by DASH CENC, playback will fail if a seek is performed. Qtdemux produces the error "stream is protected using cenc, but no cenc protection system information has been found" and playback stops. The problem is that gst_qtdemux_reset() gets called as part of the FLUSH during a seek. This function frees the protection_system_ids array. When gst_qtdemux_configure_protected_caps() is called after the seek has completed, the protection_system_ids array is empty and qtdemux is unable to create the correct output caps for the protected stream.
Created attachment 320729 [details] [review] qtdemux: support seeking of CENC encrypted streams
If the flush doesn't remove the event from the sink pad it seems to me that the reset shouldn't clean the protection ids array. Is DASH supposed to re-send the protection event? Or only if it changes? What do you think?
Given that it is a sticky event, I don't think dashdemux should re-send the event unless it changes. Changing gst_qtdemux_reset() to exclude freeing the protection_system_ids array is easy enough to do. I was worried that there might be a case where the flush was part of re-plugging the element. Re-checking the pad seemed slightly safer, if a bit more work.
If it is relinked and there is a new protection-id event it should be sent to qtdemux. I think updating reset to exclude freeing the protection_system_ids unless it is a 'hard reset' (when going to READY state, for example) makes more sense. If you free it just to read from the pad again it will have the same effect as if you had never freed it, right? If the information changes on the pad you have gotten a new event and the event handling would also update the protection-ids.
Created attachment 322378 [details] [review] qtdemux: support seeking of CENC encrypted streams Only free protection_system_ids in gst_qtdemux_reset() when performing a hard reset.
Thanks for updating the patch. Made a small change to unref the array on a block a few lines below that was already dedicated to a if(hard){} to keep code easier to maintain. commit 0c4cc1453357fa456f94119ce218fc900f77db56 Author: Alex Ashley <bugzilla@ashley-family.net> Date: Tue Feb 9 17:17:09 2016 +0000 qtdemux: support seeking of CENC encrypted streams When playing a stream that has been protected by DASH CENC, playback will fail if a seek is performed. Qtdemux produces the error "stream is protected using cenc, but no cenc protection system information has been found" and playback stops. The problem is that gst_qtdemux_reset() gets called as part of the FLUSH during a seek. This function frees the protection_system_ids array. When gst_qtdemux_configure_protected_caps() is called after the seek has completed, the protection_system_ids array is empty and qtdemux is unable to create the correct output caps for the protected stream. This commit changes it to only free the protection_system_ids on hard resets. https://bugzilla.gnome.org/show_bug.cgi?id=761787
Please verify that it still works for you. Once confirmed this can be merged to 1.8.x series.
(In reply to Thiago Sousa Santos from comment #7) > Please verify that it still works for you. Once confirmed this can be merged > to 1.8.x series. Just checked from master and seeking of a CENC stream works for me.
Merged to 1.6 and 1.8 branches 1.6: 5ba07e86e312e63f0fd592d9538dc74d56f82bfd 1.8: 95e82607ef3f80e5d155729cea5e6c05d342c62e