demux_timeline, demux_edl: correctly enable cache in pseudo-DASH mode

In pseudo-DASH mode, we may have no real streams opened until the
demuxer layer is fully loaded and playback actually starts. The only
hint that the stream is from network is, at that point, the init
segment, which is only opened as stream, and then separately as demuxer
(which is dumb but happened to fit the internal architecture better).

So just propagate the flags from the init segment stream. Seems like an
annoyance, but doesn't hurt that much I guess. (Until someone gets the
idea to pass the init segment data inline or so, but nothing does that.)

The sample link in the linked issue will probably soon switch to another
format, because that service always does this after recent uploads or
so.

Fixes: #7038
This commit is contained in:
wm4 2019-10-08 23:55:05 +02:00
parent 68bbc55eda
commit 5cbbd25090
3 changed files with 8 additions and 1 deletions

View File

@ -270,8 +270,11 @@ static struct timeline_par *build_timeline(struct timeline *root,
MP_VERBOSE(root, "Opening init fragment...\n");
stream_t *s = stream_create(parts->init_fragment_url, STREAM_READ,
root->cancel, root->global);
if (s)
if (s) {
root->is_network |= s->is_network;
root->is_streaming |= s->streaming;
tl->init_fragment = stream_read_complete(s, tl, 1000000);
}
free_stream(s);
if (!tl->init_fragment.len) {
MP_ERR(root, "Could not read init fragment.\n");

View File

@ -525,6 +525,9 @@ static int d_open(struct demuxer *demuxer, enum demux_check check)
if (!p->num_sources)
return -1;
demuxer->is_network |= p->tl->is_network;
demuxer->is_streaming |= p->tl->is_streaming;
demuxer->duration = p->duration;
print_timeline(demuxer);

View File

@ -35,6 +35,7 @@ struct timeline {
struct mp_log *log;
struct mp_cancel *cancel;
bool is_network, is_streaming;
const char *format;
// main source, and all other sources (this usually only has special meaning