summaryrefslogtreecommitdiffstats
path: root/stream/stream_lavf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-19 16:41:48 +0100
committerwm4 <wm4@nowhere>2015-03-19 16:41:48 +0100
commitaaa42f82dca51ef51d6cfe682c807bbec30940e7 (patch)
tree7c8287ac55e1dd133228c70265c5f83b6357bc2b /stream/stream_lavf.c
parent47c131bb0c3240df6a9677684d50c96226b54772 (diff)
downloadmpv-aaa42f82dca51ef51d6cfe682c807bbec30940e7.tar.bz2
mpv-aaa42f82dca51ef51d6cfe682c807bbec30940e7.tar.xz
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.
Diffstat (limited to 'stream/stream_lavf.c')
-rw-r--r--stream/stream_lavf.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c
index 1b9f7363ae..48a9aa358d 100644
--- a/stream/stream_lavf.c
+++ b/stream/stream_lavf.c
@@ -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;