demux_edl: fix assertion failure on exit in obscure ytdl cases

If a DASH-hack EDL has an init fragment is set, it opens the init
fragment as such to get the track layout (including codec etc.) and
avoids opening actual fragments until actual playback. It does not get
added to the source array, so it leaks on exit, which triggers an
obscure (but very justified) assertion in thread_tools.c:106. Fix the
leak by adding the additional demuxer instance to the sources arrays,
which gets it freed.

This is a regression from when I rewrote some of the timeline handling.
I decided that in order to make memory management slightly simpler,
freeing a timeline should only free elements in the sources array. That
is OK; I just didn't re-test with pseudo-DASH that has init fragments,
and just hit a video that uses that by accidents. These videos are
rather scarce (apparently) so it happened only now.

The real solution would probably be adding demuxer reference counting.
This EDL memory management is just too messy, and throwing refcounting
at such problems is an effective and popular fix. Then you'd get
debugging nightmares with incorrect refcounts too, though.
This commit is contained in:
wm4 2019-01-20 15:45:55 +01:00
parent a52ab8dc30
commit 5901c3ae0d
1 changed files with 1 additions and 0 deletions

View File

@ -282,6 +282,7 @@ static struct timeline_par *build_timeline(struct timeline *root,
MP_ERR(root, "Could not demux init fragment.\n");
goto error;
}
MP_TARRAY_APPEND(root, root->sources, root->num_sources, tl->track_layout);
}
tl->parts = talloc_array_ptrtype(tl, tl->parts, parts->num_parts);