[gst-devel] Problem with g_object_set
bilboed at gmail.com
Thu Jan 18 08:34:03 CET 2007
Some precisions about python and gstreamer. As Rene mentionned,
Python "virtually" handles multi-threaded applications (like a
gstreamer-based one), but the Python VM can only be executed by ONE
thread at a time. This is what the GIL (Global Interpreter Lock) is
This is why, in the gst-python bindings, we release the GIL whenever
we call C code from Python and reaquire it when we return from that C
call. In the same way, whenever in some C callbacks we call some
Python call we aquire the GIL and release it once we have stopped
calling the Python part.
The GIL protects data which is common to the Python VM as a whole
(one python VM per process, which may include several threads).
From my understanding, your env variable is common to the JAVA VM
(only one per process), therefore you need to do something similar to
what we do in gst-python with the GIL.
Hope this helps.
P.S. On a side note, I thought Java didn't have the issue Python has
with multi-threading ... so maybe this is not needed and Java already
provides you with a thread-safe way to access those global values.
On 1/17/07, René Stadler <mail at renestadler.de> wrote:
> Am Dienstag, den 16.01.2007, 20:12 +0100 schrieb Patrick Holthaus:
> > Hey!
> > > The chain function is executed in the streaming thread. Could this be
> > > the problem here? If I understand this correctly, you are calling into
> > > the Java intepreter or something. Maybe it doesn't like that if the
> > > call is coming from a thread it doesn't know about.
> > This might be the reason. I have read that the env pointer is not valid in
> > another thread. But how could i change it to use the thread that is created
> > by the Java VM? (The jmf_GSTDataSource.c file)
> > Greets
> > Patrick
> You can't, the processing is driven by GStreamer-owned threads. You
> need some form of synchronization. E.g. for Python, one needs to grab
> the GIL (global interpreter lock).
> René Stadler
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
Multimedia editing developer / Fluendo S.A.
More information about the gstreamer-devel