1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-25 04:39:47 +00:00

stream_lavf: workaround broken rtmp "timeout" option

The libavformat rtmp protocol's "timeout" option has two problems:
1) Unlike all other protocols, it's in seconds and not microseconds
2) It enables "listen" mode, which breaks playback

Make the --network-timeout do nothing in the rtmp case.

Fixes #1704.
This commit is contained in:
wm4 2015-03-19 16:41:48 +01:00
parent 47c131bb0c
commit aaa42f82dc

View File

@ -262,6 +262,13 @@ static int open_f(stream_t *stream)
filename = normalize_url(stream, filename); filename = normalize_url(stream, filename);
if (strncmp(filename, "rtmp", 4) == 0) {
stream->demuxer = "lavf";
stream->lavf_type = "flv";
// Setting timeout enables listen mode - force it to disabled.
av_dict_set(&dict, "timeout", "0", 0);
}
int err = avio_open2(&avio, filename, flags, &cb, &dict); int err = avio_open2(&avio, filename, flags, &cb, &dict);
if (err < 0) { if (err < 0) {
if (err == AVERROR_PROTOCOL_NOT_FOUND) if (err == AVERROR_PROTOCOL_NOT_FOUND)
@ -280,10 +287,6 @@ static int open_f(stream_t *stream)
} }
} }
if (strncmp(filename, "rtmp", 4) == 0) {
stream->demuxer = "lavf";
stream->lavf_type = "flv";
}
stream->priv = avio; stream->priv = avio;
stream->seekable = avio->seekable; stream->seekable = avio->seekable;
stream->seek = stream->seekable ? seek : NULL; stream->seek = stream->seekable ? seek : NULL;