Remove gstreamer_main_loop().
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 May 2021 20:50:14 +0000 (22:50 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 5 May 2021 20:52:45 +0000 (22:52 +0200)
lagarde.py

index fd8285273617185cc57b457e53ae1e704270f2b7..ca70a18f8bcd83f9b86702b9957f1da0b2938531 100755 (executable)
@@ -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: