[hls] Fix unapplied byte_range for EXT-X-MAP fragment

Cherry-picked from #3302
Authored by: fstirlitz
This commit is contained in:
felix 2022-04-21 18:22:03 +02:00 committed by pukkandan
parent 1a7cd9c487
commit e4fa34a13e
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39

View File

@ -191,6 +191,14 @@ def is_ad_fragment_end(s):
if extra_query: if extra_query:
frag_url = update_url_query(frag_url, extra_query) frag_url = update_url_query(frag_url, extra_query)
if map_info.get('BYTERANGE'):
splitted_byte_range = map_info.get('BYTERANGE').split('@')
sub_range_start = int(splitted_byte_range[1]) if len(splitted_byte_range) == 2 else byte_range['end']
byte_range = {
'start': sub_range_start,
'end': sub_range_start + int(splitted_byte_range[0]),
}
fragments.append({ fragments.append({
'frag_index': frag_index, 'frag_index': frag_index,
'url': frag_url, 'url': frag_url,
@ -200,14 +208,6 @@ def is_ad_fragment_end(s):
}) })
media_sequence += 1 media_sequence += 1
if map_info.get('BYTERANGE'):
splitted_byte_range = map_info.get('BYTERANGE').split('@')
sub_range_start = int(splitted_byte_range[1]) if len(splitted_byte_range) == 2 else byte_range['end']
byte_range = {
'start': sub_range_start,
'end': sub_range_start + int(splitted_byte_range[0]),
}
elif line.startswith('#EXT-X-KEY'): elif line.startswith('#EXT-X-KEY'):
decrypt_url = decrypt_info.get('URI') decrypt_url = decrypt_info.get('URI')
decrypt_info = parse_m3u8_attributes(line[11:]) decrypt_info = parse_m3u8_attributes(line[11:])