After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 639338 - [qtmux] Protect against copying a null caps
[qtmux] Protect against copying a null caps
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other All
: Normal normal
: 0.10.21
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-12 18:12 UTC by Thiago Sousa Santos
Modified: 2011-01-14 13:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
qtmux: Protect against copying a null caps (1.34 KB, patch)
2011-01-12 18:12 UTC, Thiago Sousa Santos
rejected Details | Review
qtmux: set src caps when starting file (1.63 KB, patch)
2011-01-13 14:29 UTC, Mark Nauwelaerts
committed Details | Review
test: qtmux: Tests qtmux reuse (1.95 KB, patch)
2011-01-13 14:30 UTC, Thiago Sousa Santos
committed Details | Review
avimux: set src pad caps (1.16 KB, patch)
2011-01-14 13:56 UTC, Mark Nauwelaerts
none Details | Review

Description Thiago Sousa Santos 2011-01-12 18:12:51 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.
Comment 1 Thiago Sousa Santos 2011-01-12 18:12:58 UTC
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.
Comment 2 Tim-Philipp Müller 2011-01-12 18:21:32 UTC
This looks to me like it papers over a bug elsewhere in qtmux, not setting the caps on the srcpad properly beforehand
Comment 3 Thiago Sousa Santos 2011-01-12 22:06:21 UTC
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?
Comment 4 Mark Nauwelaerts 2011-01-13 10:03:08 UTC
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.
Comment 5 Mark Nauwelaerts 2011-01-13 14:29:15 UTC
Created attachment 178227 [details] [review]
qtmux: set src caps when starting file

So what about this ?
Comment 6 Thiago Sousa Santos 2011-01-13 14:30:19 UTC
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.
Comment 7 Thiago Sousa Santos 2011-01-13 14:33:34 UTC
Mark's solution looks good to me, we should extend this to other muxers as well.
Comment 8 Tim-Philipp Müller 2011-01-14 00:41:12 UTC
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
Comment 9 Yang Xichuan 2011-01-14 05:24:49 UTC
(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.
Comment 10 Mark Nauwelaerts 2011-01-14 13:56:10 UTC
Created attachment 178315 [details] [review]
avimux: set src pad caps