self.pipe.set_state(Gst.State.NULL)
-async def gstreamer_main_loop():
- """Does the equivalent of the following lines in an async friendly way:
- loop = GLib.MainLoop()
- loop.run()
- """
- gst_loop = GLib.MainLoop()
- context = gst_loop.get_context()
- while True:
- events_dispatched = context.iteration(False)
- await asyncio.sleep(0. if events_dispatched else 0.01)
-
-
async def run_repeated(task):
while True:
await task()
webrtc = WebRTCClient(events)
signaling = SignalingClient(events, uri)
- main_loop_task = asyncio.Task(gstreamer_main_loop())
webrtc_task = asyncio.Task(run_repeated(webrtc.run))
signaling_task = asyncio.Task(run_repeated(signaling.run))
- done, pending = await asyncio.wait([main_loop_task, webrtc_task, signaling_task],
+ done, pending = await asyncio.wait([webrtc_task, signaling_task],
return_when=asyncio.FIRST_COMPLETED)
for task in done: