mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
janus: Remove unused parameters and refactor
This commit is contained in:
parent
255fef3896
commit
c0f303eacf
1 changed files with 9 additions and 10 deletions
|
@ -243,14 +243,12 @@ class JanusGateway:
|
||||||
return raw
|
return raw
|
||||||
|
|
||||||
class WebRTCClient:
|
class WebRTCClient:
|
||||||
def __init__(self, id_, peer_id, server, signaling):
|
def __init__(self, peer_id, server):
|
||||||
self.id_ = id_
|
|
||||||
self.conn = None
|
self.conn = None
|
||||||
self.pipe = None
|
self.pipe = None
|
||||||
self.webrtc = None
|
self.webrtc = None
|
||||||
self.peer_id = peer_id
|
self.peer_id = peer_id
|
||||||
self.server = server or 'wss://127.0.0.1:8989'
|
self.signaling = JanusGateway(server)
|
||||||
self.signaling = signaling
|
|
||||||
self.request = None
|
self.request = None
|
||||||
self.offermsg = None
|
self.offermsg = None
|
||||||
|
|
||||||
|
@ -378,7 +376,8 @@ class WebRTCClient:
|
||||||
sdpmlineindex = ice['sdpMLineIndex']
|
sdpmlineindex = ice['sdpMLineIndex']
|
||||||
self.webrtc.emit('add-ice-candidate', sdpmlineindex, candidate)
|
self.webrtc.emit('add-ice-candidate', sdpmlineindex, candidate)
|
||||||
|
|
||||||
async def loop(self, signaling):
|
async def loop(self):
|
||||||
|
signaling = self.signaling
|
||||||
await signaling.connect()
|
await signaling.connect()
|
||||||
await signaling.attach("janus.plugin.videoroom")
|
await signaling.attach("janus.plugin.videoroom")
|
||||||
|
|
||||||
|
@ -420,6 +419,8 @@ class WebRTCClient:
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
async def close(self):
|
||||||
|
return await self.signaling.close()
|
||||||
|
|
||||||
def check_plugins():
|
def check_plugins():
|
||||||
needed = ["opus", "vpx", "nice", "webrtc", "dtls", "srtp", "rtp",
|
needed = ["opus", "vpx", "nice", "webrtc", "dtls", "srtp", "rtp",
|
||||||
|
@ -439,16 +440,14 @@ if __name__=='__main__':
|
||||||
parser.add_argument('label', help='videoroom label')
|
parser.add_argument('label', help='videoroom label')
|
||||||
parser.add_argument('--server', help='Signalling server to connect to, eg "wss://127.0.0.1:8989"')
|
parser.add_argument('--server', help='Signalling server to connect to, eg "wss://127.0.0.1:8989"')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
our_id = random.randrange(10, 10000)
|
c = WebRTCClient(args.label, args.server)
|
||||||
signaling = JanusGateway(args.server)
|
|
||||||
c = WebRTCClient(our_id, args.label, args.server, signaling)
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(
|
loop.run_until_complete(
|
||||||
c.loop(signaling)
|
c.loop()
|
||||||
)
|
)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
print("Interrupted, cleaning up")
|
print("Interrupted, cleaning up")
|
||||||
loop.run_until_complete(signaling.close())
|
loop.run_until_complete(c.close())
|
||||||
|
|
Loading…
Reference in a new issue