ytdl_hook: fix pseudo-DASH if no init fragment is present

Init fragments are not a necessity for DASH, but this code assumed so.
Maybe the check was to prevent worse. But using normal EDL here leads to
very shitty behavior where it tries to open hundreds or thousands of
fragments, each with its own demuxer and HTTP connection. (This behavior
is fine for normal uses of EDLs, but completely unacceptable when
emulating fragmented streaming protocols. I'm not sure why the normal
EDL code is needed here, but I think someone claimed some obscure sites
just need it.)

This happens in the same situation as the one described in the previous
commit.
This commit is contained in:
wm4 2019-01-05 14:34:31 +01:00
parent 80d2016075
commit d23336089c
1 changed files with 11 additions and 5 deletions

View File

@ -222,12 +222,18 @@ local function edl_track_joined(fragments, protocol, is_live, base)
local offset = 1
local parts = {}
if (protocol == "http_dash_segments") and
not fragments[1].duration and not is_live then
if (protocol == "http_dash_segments") and not is_live then
msg.debug("Using dash")
local args = ""
-- assume MP4 DASH initialization segment
table.insert(parts,
"!mp4_dash,init=" .. edl_escape(join_url(base, fragments[1])))
offset = 2
if not fragments[1].duration then
msg.debug("Using init segment")
args = args .. ",init=" .. edl_escape(join_url(base, fragments[1]))
offset = 2
end
table.insert(parts, "!mp4_dash" .. args)
-- Check remaining fragments for duration;
-- if not available in all, give up.