Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GStreamer WebRTC signaling compatibility

Discussion in 'Unity Render Streaming' started by dustinkerstein, Sep 4, 2021.

  1. dustinkerstein

    dustinkerstein

    Joined:
    Jan 26, 2017
    Posts:
    16
    I'm trying to interface the GStreamer WebRTC examples with Unity3D WebRTC support via the Render Streaming demo scenes, but am running into what appears to be a signaling conflict. When I run the Gst-example's simple-server.py I end up with this error when trying to connect from Unity.

    nano@jetson:~/GitHub/gst-examples/webrtc/signalling$ python3 simple_server.py
    Starting server...
    Using TLS with keys in ''
    Listening on https://:8443
    Connected to ('192.168.86.204', 58207)
    Error in connection handler
    Traceback (most recent call last):
    File "/home/nano/.local/lib/python3.6/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
    File "simple_server.py", line 262, in handler
    peer_id = await self.hello_peer(ws)
    File "simple_server.py", line 221, in hello_peer
    raise Exception("Invalid hello from {!r}".format(raddr))
    Exception: Invalid hello from ('192.168.86.204', 58207)
    Connected to ('192.168.86.204', 58210)


    And when I use Unity's Web App signaling I am able to connect inside Unity, but as soon as I try to send video data from GStreamer, I get this error:

    nano@jetson:~/GitHub/gst-examples/webrtc/sendrecv/gst$ python3 webrtc_sendrecv.py 123 --server=wss://192.168.86.204
    Traceback (most recent call last):
    File "webrtc_sendrecv.py", line 189, in <module>
    loop.run_until_complete(c.connect())
    File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
    File "webrtc_sendrecv.py", line 40, in connect
    self.conn = await websockets.connect(self.server, ssl=sslctx)
    File "/home/nano/.local/lib/python3.6/site-packages/websockets/legacy/client.py", line 622, in __await_impl__
    transport, protocol = await self._create_connection()
    File "/usr/lib/python3.6/asyncio/base_events.py", line 794, in create_connection
    raise exceptions[0]
    File "/usr/lib/python3.6/asyncio/base_events.py", line 781, in create_connection
    yield from self.sock_connect(sock, address)
    File "/usr/lib/python3.6/asyncio/selector_events.py", line 439, in sock_connect
    return (yield from fut)
    File "/usr/lib/python3.6/asyncio/selector_events.py", line 469, in _sock_connect_cb
    raise OSError(err, 'Connect call failed %s' % (address,))
    ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.86.204', 443)


    I haven't dug too deep yet, but it appears they aren't in agreement on the signaling standard. I will also cross-post this on the GStreamer repo, but let me know if anyone sees an easy fix to get these two WebRTC components working together. Thanks!