From 729f17407ffad07f92cf14d0d21c8925812b8205 Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Wed, 5 May 2021 22:50:14 +0200 Subject: [PATCH] Remove gstreamer_main_loop(). --- lagarde.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lagarde.py b/lagarde.py index fd82852..ca70a18 100755 --- a/lagarde.py +++ b/lagarde.py @@ -308,18 +308,6 @@ class WebRTCClient: 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() @@ -334,11 +322,10 @@ async def run(uri): 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: -- 2.39.5