summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-23 11:09:42 +0100
committerwm4 <wm4@nowhere>2019-12-23 11:09:42 +0100
commit36da3325a3ee51a22c21ebc6492f243fafc3c95f (patch)
tree512deaa94e9a2836c645490de8d76d529619ec4b /demux/demux.c
parentaf6652004d5f712e140996a17c683d437f4b8bb3 (diff)
downloadmpv-36da3325a3ee51a22c21ebc6492f243fafc3c95f.tar.bz2
mpv-36da3325a3ee51a22c21ebc6492f243fafc3c95f.tar.xz
demux: stop setting dummy stream on demux_close_stream()
Demuxers can call demux_close_stream() to close the underlying stream if it's not needed anymore. (Useful to release "heavy" resources like FDs and sockets. Plus merely keeping a file open can have visible side effects such as inability to unmount a filesystem or, on Windows, to do anything with the file.) Until now, this set demuxer->stream to a dummy stream, because most code used to assume that the stream field is non-NULL. But this requirement disappeared (in some cases, the stream field is already NULL), so stop doing that. demux_lavf.c, one of the demuxers which calls this function, still had some of this, though.
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 1bf0277873..c0b0c2fb65 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -3104,7 +3104,6 @@ static void demux_init_cuesheet(struct demuxer *demuxer)
// Calling this after opening was completed is not allowed. Also, if opening
// failed, this must not be called (or trying another demuxer would fail).
// Useful so that e.g. subtitles don't keep the file or socket open.
-// Replaces it with a dummy stream for dumb reasons.
// If there's ever the situation where we can't allow the demuxer to close
// the stream, this function could ignore the request.
void demux_close_stream(struct demuxer *demuxer)
@@ -3117,9 +3116,8 @@ void demux_close_stream(struct demuxer *demuxer)
MP_VERBOSE(demuxer, "demuxer read all data; closing stream\n");
free_stream(demuxer->stream);
- demuxer->stream = stream_memory_open(demuxer->global, NULL, 0); // dummy
- demuxer->stream->cancel = demuxer->cancel;
- in->d_user->stream = demuxer->stream;
+ demuxer->stream = NULL;
+ in->d_user->stream = NULL;
}
static void demux_init_ccs(struct demuxer *demuxer, struct demux_opts *opts)