Python, sockets, GStreamer and the Garbage collector
Long time no blog, eh? Anyway I was today hooking up Telepathy Stream Tubes with GStreamer so that I could stream video over local-xmpp, go figure why... :)
Everything was fine:
on one side, offer a stream tube in a multi-user room and setup a pipeline like this one:
videotestsrc ! gdppay ! multifdsink
on client side, join the room and accept the tube, hooked into the following pipeline with a socket:
fdsrc ! gdpdepay ! xvimagesink
when server is notified of new client, add its socket fd in multifdsink and start playback
But it wasn't working, multifdsink was removing the fd by itself from the list and client wasn't receiving data. I spent some time this afternoon trying to figure out why and thought I might share the solution, if it can serve to anyone using multifdsink in Python. Because I wasn't keeping references of the client socket instances in my code, they were garbage-collected by Python, so the fd was becoming invalid, hence the rejection by multifdsink.
Keeping a list of the socket instances and cleaning it up when the sink emits the client-removed signal does the trick and I got my video streaming over local-xmpp working. Those Tubes are so much fun, thanks Collabora & Telepathy folks for this nice stuff!
#. phil on Sun May 24 22:40:03 2009
You'll need Coherence trunk too: http://coherence.beebits.net/
Unfortunately this strategy doesn't work on Jabber because the Telepathy Gabble manager handles stream tubes as in-bound connections. So I started looking at how I could use Farsight Stream Engine to achieve video streaming over Jabber ;)

#. wiflye81 on Sun May 24 22:05:03 2009
It's great and seem simple at the same time, can we have a little sample ?