webrtc-sendrecv.py: improve debug and documentation

This commit is contained in:
Mathieu Duponchelle 2018-06-11 20:26:07 +02:00
parent 56c17d6487
commit 3603899291
2 changed files with 8 additions and 2 deletions

View file

@ -74,6 +74,12 @@ $ gcc webrtc-sendrecv.c $(pkg-config --cflags --libs gstreamer-webrtc-1.0 gstrea
* python3 -m pip install --user websockets
* run `python3 sendrecv/gst/webrtc-sendrecv.py ID` with the `id` from the browser. You will see state changes and an SDP exchange.
> The python version currently requires the master branches from `gst-plugins-bad` and `gst-plugins-base`.
<!---
TODO: replace the note above when 1.16 is released
-->
With all versions, you will see a bouncing ball + hear red noise in the browser, and your browser's webcam + mic in the gst app.
You can pass a --server argument to all versions, for example `--server=wss://127.0.0.1:8443`.

View file

@ -42,7 +42,7 @@ class WebRTCClient:
def send_sdp_offer(self, offer):
text = offer.sdp.as_text()
print ('Sending offer:\n%s', text)
print ('Sending offer:\n%s' % text)
msg = json.dumps({'sdp': {'type': 'offer', 'sdp': text}})
loop = asyncio.new_event_loop()
loop.run_until_complete(self.conn.send(msg))
@ -120,7 +120,7 @@ class WebRTCClient:
sdp = msg['sdp']
assert(sdp['type'] == 'answer')
sdp = sdp['sdp']
print ('Received answer:\n%s', sdp)
print ('Received answer:\n%s' % sdp)
res, sdpmsg = GstSdp.SDPMessage.new_from_text(sdp)
answer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.ANSWER, sdpmsg)
promise = Gst.Promise.new()