summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-20 15:28:49 +0100
committerwm4 <wm4@nowhere>2020-02-20 15:28:49 +0100
commit6726b7a1ba5248e4edcab3dbd24c730551afb012 (patch)
treed4859e77efe147a98c7351ece6abbdde5cecef48
parentbd6d8d320ff4fe803a956853a40c9e7605cc8ade (diff)
downloadmpv-6726b7a1ba5248e4edcab3dbd24c730551afb012.tar.bz2
mpv-6726b7a1ba5248e4edcab3dbd24c730551afb012.tar.xz
demux_lavf: signal no seeking for RTSP streams without duration
RTSP supports seeking, but at least the libavformat implementation makes this dependent on runtime behavior. So you have to perform a seek, and check if it fails. But even if you do this, the stream is interrupted and restarted, and there seem to be other issues. Assume that RTSP with unknown duration means it's a live stream, and disable seeking in this case, as suggested by the issue reporter. Fixes: #7472
-rw-r--r--demux/demux_lavf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 62fecde8ea..fe127cdb08 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -146,6 +146,7 @@ struct format_hack {
bool is_network : 1;
bool no_seek : 1;
bool no_pcm_seek : 1;
+ bool no_seek_on_no_duration : 1;
};
#define BLACKLIST(fmt) {fmt, .ignore = true}
@@ -174,6 +175,7 @@ static const struct format_hack format_hacks[] = {
{"matroska", .skipinfo = true, .no_pcm_seek = true, .use_stream_ids = true},
{"v4l2", .no_seek = true},
+ {"rtsp", .no_seek_on_no_duration = true},
// In theory, such streams might contain timestamps, but virtually none do.
{"h264", .if_flags = AVFMT_NOTIMESTAMPS },
@@ -1090,6 +1092,9 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
demuxer->duration = duration;
}
+ if (demuxer->duration < 0 && priv->format_hack.no_seek_on_no_duration)
+ demuxer->seekable = false;
+
// In some cases, libavformat will export bogus bullshit timestamps anyway,
// such as with mjpeg.
if (priv->avif_flags & AVFMT_NOTIMESTAMPS) {