mirror of
https://github.com/mpv-player/mpv
synced 2025-04-25 12:50:18 +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:
parent
47c131bb0c
commit
aaa42f82dc
@ -262,6 +262,13 @@ static int open_f(stream_t *stream)
|
||||
|
||||
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);
|
||||
if (err < 0) {
|
||||
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->seekable = avio->seekable;
|
||||
stream->seek = stream->seekable ? seek : NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user