"on-negotiation-needed" 在尝试使用 gstreamer webrtc 进行流式传输时如何工作?
How does "on-negotiation-needed" work when trying to stream using gstreamer webrtc?
webrtc 管道如何获取有关其对等点的任何信息?
这就是我假设 on_negotiation_needed 回调的作用?
def start_pipeline(self):
self.pipe = Gst.parse_launch(PIPELINE_DESC)
self.webrtc = self.pipe.get_by_name('sendrecv')
**self.webrtc.connect('on-negotiation-needed', self.on_negotiation_needed)**
self.webrtc.connect('on-ice-candidate', self.send_ice_candidate_message)
self.webrtc.connect('pad-added', self.on_incoming_stream)
self.pipe.set_state(Gst.State.PLAYING)
我看到它有 on_negotiation_needed 回调,但不清楚元素变量来自哪里?我看了这里:http://blog.nirbheek.in/2018/02/gstreamer-webrtc.html and here: https://github.com/centricular/gstwebrtc-demos 但我仍然对谈判的运作方式感到困惑?据我了解,有 2 个(或更多)对等点,它们都必须连接到信令服务器,然后其中一个必须创建报价。
我等待来自(我假设)信令服务器上的 gstreamer webrtcbin 的消息:
print (websocket.remote_address)
#get message from client
message = await asyncio.wait_for(websocket.recv(), 3000)
我在管道启动时收到此错误:
('192.168.11.138', 44120)
Error in connection handler
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 674, in transfer_data
message = yield from self.read_message()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 742, in read_message
frame = yield from self.read_data_frame(max_size=self.max_size)
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 815, in read_data_frame
frame = yield from self.read_frame(max_size)
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 884, in read_frame
extensions=self.extensions,
File "/usr/local/lib/python3.6/dist-packages/websockets/framing.py", line 99, in read
data = yield from reader(2)
File "/usr/lib/python3.6/asyncio/streams.py", line 672, in readexactly
raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/websockets/server.py", line 169, in handler
yield from self.ws_handler(self, path)
File "signaling_server.py", line 34, in signaling
message = await asyncio.wait_for(websocket.recv(), 3000)
File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 434, in recv
yield from self.ensure_open()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 646, in ensure_open
) from self.transfer_data_exc
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason
我不能说 Python(不幸的是,无法为 GStreamer 的 Python 绑定在 Windows 上工作),但是,演示可以从 C# 运行(我刚刚检查过)。
首先,您应该将浏览器连接到 https://webrtc.nirbheek.in/,然后获取 'Our id' 值。
您的 Python Gstreamer 应该连接到 wss://webrtc.nirbheek.in:8443,并使用来自浏览器的 Id 值。
浏览器将从GStreamer 获取测试图像流,GStreamer 应用程序将从浏览器获取网络摄像头图像。
HTH,汤姆
截图如下:
webrtc 管道如何获取有关其对等点的任何信息?
这就是我假设 on_negotiation_needed 回调的作用?
def start_pipeline(self):
self.pipe = Gst.parse_launch(PIPELINE_DESC)
self.webrtc = self.pipe.get_by_name('sendrecv')
**self.webrtc.connect('on-negotiation-needed', self.on_negotiation_needed)**
self.webrtc.connect('on-ice-candidate', self.send_ice_candidate_message)
self.webrtc.connect('pad-added', self.on_incoming_stream)
self.pipe.set_state(Gst.State.PLAYING)
我看到它有 on_negotiation_needed 回调,但不清楚元素变量来自哪里?我看了这里:http://blog.nirbheek.in/2018/02/gstreamer-webrtc.html and here: https://github.com/centricular/gstwebrtc-demos 但我仍然对谈判的运作方式感到困惑?据我了解,有 2 个(或更多)对等点,它们都必须连接到信令服务器,然后其中一个必须创建报价。
我等待来自(我假设)信令服务器上的 gstreamer webrtcbin 的消息:
print (websocket.remote_address)
#get message from client
message = await asyncio.wait_for(websocket.recv(), 3000)
我在管道启动时收到此错误:
('192.168.11.138', 44120)
Error in connection handler
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 674, in transfer_data
message = yield from self.read_message()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 742, in read_message
frame = yield from self.read_data_frame(max_size=self.max_size)
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 815, in read_data_frame
frame = yield from self.read_frame(max_size)
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 884, in read_frame
extensions=self.extensions,
File "/usr/local/lib/python3.6/dist-packages/websockets/framing.py", line 99, in read
data = yield from reader(2)
File "/usr/lib/python3.6/asyncio/streams.py", line 672, in readexactly
raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/websockets/server.py", line 169, in handler
yield from self.ws_handler(self, path)
File "signaling_server.py", line 34, in signaling
message = await asyncio.wait_for(websocket.recv(), 3000)
File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 434, in recv
yield from self.ensure_open()
File "/usr/local/lib/python3.6/dist-packages/websockets/protocol.py", line 646, in ensure_open
) from self.transfer_data_exc
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason
我不能说 Python(不幸的是,无法为 GStreamer 的 Python 绑定在 Windows 上工作),但是,演示可以从 C# 运行(我刚刚检查过)。
首先,您应该将浏览器连接到 https://webrtc.nirbheek.in/,然后获取 'Our id' 值。
您的 Python Gstreamer 应该连接到 wss://webrtc.nirbheek.in:8443,并使用来自浏览器的 Id 值。
浏览器将从GStreamer 获取测试图像流,GStreamer 应用程序将从浏览器获取网络摄像头图像。
HTH,汤姆
截图如下: