GNOME Bugzilla – Bug 659640
[Input-selector] with two videotestsrc is loaded while switching above zero cause crash
Last modified: 2011-09-20 21:18:54 UTC
Load videotestsrc twice as input-source and switch the active-pad above 0 cause crash. To reproduce please do: 1. vi ButtonTest11.java import org.gstreamer.*; public class ButtonTest11 { public static Pipeline pipe = null; public ButtonTest11() {} public static void main(String[] args) { Gst.init(); String vtest = "videotestsrc pattern=18 ! queue ! s.sink0 videotestsrc pattern=1 ! queue ! s.sink1 input-selector name=s ! videoscale ! video/x-raw-yuv,width=340,height=200,framerate=90/1 ! xvimagesink name=gl"; pipe = Pipeline.launch(vtest); final Element videoSink = pipe.getElementByName("gl"); pipe.play(); try { final Element breakit = pipe.getElementByName("s"); //System.err.println(breakit.get("active-pad")); breakit.set("active-pad", 1); // To produce the bug change the 0 to 1 } catch (Exception ex) { } Gst.main(); } } 2. Compile/Run 3. You will get similar crash run: Pad: [sink1] # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x48c0de1d, pid=21200, tid=3077487472 # # JRE version: 6.0_22-b22 # Java VM: OpenJDK Server VM (20.0-b11 mixed mode linux-x86 ) # Derivative: IcedTea6 1.10.3 # Distribution: Fedora release 15 (Lovelock), package fedora-59.1.10.3.fc15-i386 # Problematic frame: # C [libgobject-2.0.so.0+0xde1d] g_free+0xde1d # # An error report file with more information is saved as: # hs_err_pid21200.log # # If you would like to submit a bug report, please include # instructions how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # Java Result: 134 BUILD SUCCESSFUL (total time: 4 seconds) Temporary: if i only keep 0 it works without crash. But with 0 real input source gets frozen.
Trying to repro this, I notice that active-pad's type is not an index, but a GstPad. To make this work, you'll need to retrieve the pad from the upstrea element, and use this to set active-pad to. As it is, you're trying to get gstreamer to use (GstPad*)1, which will indeed crash for good reason.
@Vincent Penquerc'h: Thank you. That was the issue for sure.
That said, it would seem like a good idea to have an set-by-index. Using pad pointers seems more complicated than it needs, but maybe typical uses cannot always give inputs in the same order.