GNOME Bugzilla – Bug 639338
[qtmux] Protect against copying a null caps
Last modified: 2011-01-14 13:57:59 UTC
Using qtmux with encodebin is causing an assertion on line 1472: caps = gst_caps_copy (GST_PAD_CAPS (mux->srcpad)); the srcpad caps is NULL. Attached patch fixes it.
Created attachment 178165 [details] [review] qtmux: Protect against copying a null caps Check if the srcpad actually has caps before attempting to copy it. Somehow using encodebin with qtmux was leading to problems regarding this when putting the streamheader on caps.
This looks to me like it papers over a bug elsewhere in qtmux, not setting the caps on the srcpad properly beforehand
The problem is that qtmux sets the srcpad caps on its constructor and then on pads deactivation the pad caps is set to NULL and stays at that forever. On the constructor, qtmux also sets the srcpad to use_fixed_caps, not sure what exactly should happen here with use_fixed_caps and set_caps to NULL, anyone?
At first glance, this may be a problem for other elements/muxers as well (e.g. avimux). Then they probably need some proper incantation to set src pad caps in their _start.
Created attachment 178227 [details] [review] qtmux: set src caps when starting file So what about this ?
Created attachment 178228 [details] [review] test: qtmux: Tests qtmux reuse A small test to reproduce the issue. Forces the use of qtmux after it has been put to PLAYING and back to NULL once.
Mark's solution looks good to me, we should extend this to other muxers as well.
Who's going to check the other muxers? commit f59a1d28686690ca9189ec48243479aa2cf81e6a Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk> Date: Thu Jan 13 11:28:32 2011 -0300 test: qtmux: Tests qtmux reuse Forces the use of qtmux after it has been put to PLAYING and back to NULL once https://bugzilla.gnome.org/show_bug.cgi?id=639338 commit b496bf923c2144aa02535f59db2ae4f3e1a25c34 Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> Date: Thu Jan 13 15:27:36 2011 +0100 qtmux: set src pads when starting file ... rather than at _init time, so they are also available following a pad (de)activation cycle. https://bugzilla.gnome.org/show_bug.cgi?id=639338
(In reply to comment #5) > Created an attachment (id=178227) [details] [review] > qtmux: set src caps when starting file > > So what about this ? That's nice. But I am not sure here that why you don't use the return value of the function "gst_pad_set_caps (qtmux->srcpad, caps);" Could you explain it? I am a newbie here, and want to learn more here.
Created attachment 178315 [details] [review] avimux: set src pad caps