demux: unconditionally reposition stream to start before opening

The old code made it depend on ->seekable. If it isn't seekable, and
something discarded the data, then it'll just show an error message,
which will at least be somewhat informative. If no data was discarded,
the seek call is always a no-op.

There's a weird "timeline" condition in the old code; this doesn't
matter anymore, because timeline stuff does not pass streams down to
nested demuxers anymore.
This commit is contained in:
wm4 2019-11-06 21:34:52 +01:00
parent 517489814d
commit 48fc642e0c
1 changed files with 3 additions and 2 deletions

View File

@ -3214,6 +3214,9 @@ static struct demuxer *open_given_type(struct mpv_global *global,
mp_dbg(log, "Trying demuxer: %s (force-level: %s)\n",
desc->name, d_level(check));
if (stream)
stream_seek(stream, 0);
in->d_thread->params = params; // temporary during open()
int ret = demuxer->desc->open(in->d_thread, check);
if (ret >= 0) {
@ -3323,8 +3326,6 @@ static struct demuxer *demux_open(struct stream *stream,
for (int n = 0; demuxer_list[n]; n++) {
const struct demuxer_desc *desc = demuxer_list[n];
if (!check_desc || desc == check_desc) {
if (stream->seekable && (!params || !params->timeline))
stream_seek(stream, 0);
demuxer = open_given_type(global, log, desc, stream, &sinfo,
params, level);
if (demuxer) {