Pregunta

I'm trying to setup a GStreamer appsrc as a video source, but even a trivial program does not work at all and produces random crashes or hangings so far. Could you please help to spot the problem? Minimal crashing code:

import gst, gtk

def need_data(src, need_bytes):
    src.emit("push-buffer", gst.Buffer(" "*need_bytes))

def on_message(bus, msg):
    print "on_message", msg

pipeline = gst.parse_launch("appsrc name=src ! fakesink")

src = pipeline.get_by_name("src")
src.connect("need-data", need_data)
src.set_property("blocksize", 640*480*3)

bus = pipeline.get_bus()
bus.add_signal_watch()
bus.connect("message", on_message)

pipeline.set_state(gst.STATE_PLAYING)
gtk.main()
¿Fue útil?

Solución

The solution appeared to be quite simple. At some point program was lucky to spit Fatal Python error: GC object already tracked message, and it became pretty clear: a call to gobject.threads_init() was missing. Adding this call to the beginning of the program fixed the issue.

Otros consejos

You can use gst-debug-level to probe further into the problem.

Lets say your code is in the file gst-test.py.

Launch it like this:

python gst-test.py --gst-debug-level=3

This will give you a better idea about whats going on. Try changing the value from 3 to 1 to lower the noise.

My gut feeling is that you are missing the caps. You'll also probably have to set the props too.

I've run into this issue 'GC object already tracked' and did try adding the code gobject.threads_init() but it still did not fix the issue.

There were couple of suggestions in below article to diagnose this issue. Hope that helps. Python memory debugging with GDB

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top