From cb2c58c75c66ee994bf6bd8f944d38b0e20067a9 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Sun, 26 Nov 2023 15:15:57 +1100 Subject: [PATCH] restreamer: Yield the event loop during playlist generation --- restreamer/restreamer/generate_hls.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/restreamer/restreamer/generate_hls.py b/restreamer/restreamer/generate_hls.py index dd7cd9d..c79e935 100644 --- a/restreamer/restreamer/generate_hls.py +++ b/restreamer/restreamer/generate_hls.py @@ -3,6 +3,7 @@ import os import urllib.parse from collections import Counter +import gevent def generate_master(playlists): """Generate master playlist. Playlists arg should be a map {name: url}. @@ -69,6 +70,8 @@ def generate_media(segments, base_url): segments = segments[1:] for segment in segments: + # For very large playlists, give other things a chance to run + gevent.idle() if segment is None: # Discontinuity. Adding this tag tells the client that we've missed something # and it should start decoding fresh on the next segment. This is required when