diff options
author | wm4 <wm4@nowhere> | 2019-01-20 15:45:55 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:04 +0200 |
commit | 5901c3ae0d11b52c290ebb785c1f6cf7256ae255 (patch) | |
tree | ea912a8ed5c19466411a4a279459a84f3b7e1fed /demux | |
parent | a52ab8dc307f24cf17169fbb13f08740e02e6639 (diff) | |
download | mpv-5901c3ae0d11b52c290ebb785c1f6cf7256ae255.tar.bz2 mpv-5901c3ae0d11b52c290ebb785c1f6cf7256ae255.tar.xz |
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.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_edl.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/demux/demux_edl.c b/demux/demux_edl.c index 27c1a527f9..205d607427 100644 --- a/demux/demux_edl.c +++ b/demux/demux_edl.c @@ -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); |