mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
webrtc_sendrecv.py: Fix PEP8 warnings in CI lint
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3816>
This commit is contained in:
parent
dff9f5151b
commit
26ee3d83fb
1 changed files with 11 additions and 12 deletions
|
@ -6,6 +6,10 @@
|
|||
# Demo gstreamer app for negotiating and streaming a sendrecv webrtc stream
|
||||
# with a browser JS app, implemented in Python.
|
||||
|
||||
from websockets.version import version as wsv
|
||||
from gi.repository import GstSdp
|
||||
from gi.repository import GstWebRTC
|
||||
from gi.repository import Gst
|
||||
import random
|
||||
import ssl
|
||||
import websockets
|
||||
|
@ -17,11 +21,8 @@ import argparse
|
|||
|
||||
import gi
|
||||
gi.require_version('Gst', '1.0')
|
||||
from gi.repository import Gst
|
||||
gi.require_version('GstWebRTC', '1.0')
|
||||
from gi.repository import GstWebRTC
|
||||
gi.require_version('GstSdp', '1.0')
|
||||
from gi.repository import GstSdp
|
||||
|
||||
# Ensure that gst-python is installed
|
||||
try:
|
||||
|
@ -53,8 +54,6 @@ PIPELINE_DESC = {
|
|||
'VP8': PIPELINE_DESC_VP8,
|
||||
}
|
||||
|
||||
from websockets.version import version as wsv
|
||||
|
||||
|
||||
def print_status(msg):
|
||||
print(f'--- {msg}')
|
||||
|
@ -159,7 +158,7 @@ class WebRTCClient:
|
|||
self.send_soon(msg)
|
||||
|
||||
def on_offer_created(self, promise, _, __):
|
||||
assert(promise.wait() == Gst.PromiseResult.REPLIED)
|
||||
assert promise.wait() == Gst.PromiseResult.REPLIED
|
||||
reply = promise.get_reply()
|
||||
offer = reply['offer']
|
||||
promise = Gst.Promise.new()
|
||||
|
@ -235,7 +234,7 @@ class WebRTCClient:
|
|||
self.pipe.set_state(Gst.State.PLAYING)
|
||||
|
||||
def on_answer_created(self, promise, _, __):
|
||||
assert(promise.wait() == Gst.PromiseResult.REPLIED)
|
||||
assert promise.wait() == Gst.PromiseResult.REPLIED
|
||||
reply = promise.get_reply()
|
||||
answer = reply['answer']
|
||||
promise = Gst.Promise.new()
|
||||
|
@ -244,7 +243,7 @@ class WebRTCClient:
|
|||
self.send_sdp(answer)
|
||||
|
||||
def on_offer_set(self, promise, _, __):
|
||||
assert(promise.wait() == Gst.PromiseResult.REPLIED)
|
||||
assert promise.wait() == Gst.PromiseResult.REPLIED
|
||||
promise = Gst.Promise.new_with_change_func(self.on_answer_created, None, None)
|
||||
self.webrtc.emit('create-answer', None, promise)
|
||||
|
||||
|
@ -270,17 +269,17 @@ class WebRTCClient:
|
|||
if not self.webrtc:
|
||||
print_status('Incoming call: received an offer, creating pipeline')
|
||||
pts = get_payload_types(sdpmsg, video_encoding=self.video_encoding, audio_encoding='OPUS')
|
||||
assert(self.video_encoding in pts)
|
||||
assert('OPUS' in pts)
|
||||
assert self.video_encoding in pts
|
||||
assert 'OPUS' in pts
|
||||
self.start_pipeline(create_offer=False, video_pt=pts[self.video_encoding], audio_pt=pts['OPUS'])
|
||||
|
||||
assert(self.webrtc)
|
||||
assert self.webrtc
|
||||
|
||||
offer = GstWebRTC.WebRTCSessionDescription.new(GstWebRTC.WebRTCSDPType.OFFER, sdpmsg)
|
||||
promise = Gst.Promise.new_with_change_func(self.on_offer_set, None, None)
|
||||
self.webrtc.emit('set-remote-description', offer, promise)
|
||||
elif 'ice' in msg:
|
||||
assert(self.webrtc)
|
||||
assert self.webrtc
|
||||
ice = msg['ice']
|
||||
candidate = ice['candidate']
|
||||
sdpmlineindex = ice['sdpMLineIndex']
|
||||
|
|
Loading…
Reference in a new issue