restreamer: Yield the event loop during playlist generation

pull/389/head
Mike Lang 1 year ago committed by Mike Lang
parent be7a9cd1fa
commit cb2c58c75c

@ -3,6 +3,7 @@ import os
import urllib.parse import urllib.parse
from collections import Counter from collections import Counter
import gevent
def generate_master(playlists): def generate_master(playlists):
"""Generate master playlist. Playlists arg should be a map {name: url}. """Generate master playlist. Playlists arg should be a map {name: url}.
@ -69,6 +70,8 @@ def generate_media(segments, base_url):
segments = segments[1:] segments = segments[1:]
for segment in segments: for segment in segments:
# For very large playlists, give other things a chance to run
gevent.idle()
if segment is None: if segment is None:
# Discontinuity. Adding this tag tells the client that we've missed something # 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 # and it should start decoding fresh on the next segment. This is required when

Loading…
Cancel
Save