self.pipe.add(capsfilter)
self.pipe.add(flmux)
self.pipe.add(sink)
- self.pipe.sync_children_states()
q_pad_sink = q.get_static_pad('sink')
assert q_pad_sink
ok = flmux.link(sink)
assert ok
self.pipe.set_state(Gst.State.PLAYING)
+ self.pipe.sync_children_states()
#print(dir(Gst.DebugGraphDetails))
#Gst.debug_bin_to_dot_data(element, Gst.DebugGraphDetails.ALL)
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()
async def run(uri):
try:
events = Events()
-
# rtsp = RtspServer()
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))
+ webrtc_task = asyncio.Task(webrtc.run())
+ signaling_task = asyncio.Task(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: