forked from DRMTalks/devine
Fix possible soft-lock in HLS if Queue is left empty after error
This commit is contained in:
parent
7df6aa42b4
commit
c3a22431f0
|
@ -222,6 +222,7 @@ class HLS:
|
|||
segment_save_path = (save_dir / filename).with_suffix(".mp4")
|
||||
|
||||
newest_segment_key = segment_key.get()
|
||||
try:
|
||||
if segment.key and newest_segment_key[1] != segment.key:
|
||||
try:
|
||||
drm = HLS.get_drm(
|
||||
|
@ -246,12 +247,14 @@ class HLS:
|
|||
raise ValueError("license_widevine func must be supplied to use Widevine DRM")
|
||||
license_widevine(drm)
|
||||
newest_segment_key = (drm, segment.key)
|
||||
finally:
|
||||
segment_key.put(newest_segment_key)
|
||||
|
||||
if callable(track.OnSegmentFilter) and track.OnSegmentFilter(segment):
|
||||
return 0
|
||||
|
||||
newest_init_data = init_data.get()
|
||||
try:
|
||||
if segment.init_section and (not newest_init_data or segment.discontinuity):
|
||||
# Only use the init data if there's no init data yet (e.g., start of file)
|
||||
# or if EXT-X-DISCONTINUITY is reached at the same time as EXT-X-MAP.
|
||||
|
@ -264,6 +267,7 @@ class HLS:
|
|||
res = session.get(segment.init_section.uri)
|
||||
res.raise_for_status()
|
||||
newest_init_data = res.content
|
||||
finally:
|
||||
init_data.put(newest_init_data)
|
||||
|
||||
if not segment.uri.startswith(segment.base_uri):
|
||||
|
|
Loading…
Reference in New Issue