multisocketsink and Gio.Socket() issues (python)

Krutskikh Ivan stein.hak at gmail.com
Mon Mar 21 11:17:48 UTC 2016


Hi,

I want to create a pipeline with multisocketsink, add a socket to it and
then read from it as a normal python socket.

If i do:

client_id = Gio.Socket().new_from_fd(wfile.fileno())
self.clients.append(client_id)
self.sink.emit("add", client_id)
while client_id in self.clients:
   time.sleep(1)

everything fine exept that if connection breaks on gstreamer side (
client_id gets removed by timeout), the socket just waits forever for
incoming data. Adding client_id.set_timeout(1) does not help in any way

So I wanted to make a more manual approach:

client_id = Gio.Socket()
client_id.set_timeout(1)
self.clients.append(client_id)
while True:
   data = client_id.receive(1024)
   if not data:
      break
   else:
      wfile.write(data)
      wfile.flush()

But that does not work. I see socket being added to multisocket sink and
removed after timeout. No data is passed to wfile. Just to be clear: I
tried using python's own socket module, but I cannot even add this socket
to gstreamer. :(

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160321/ee6e8792/attachment.html>


More information about the gstreamer-devel mailing list