summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-22 02:40:29 +0200
committerwm4 <wm4@nowhere>2013-09-22 02:40:29 +0200
commitb0f7a26f1a6dc061db0a60908842371e7a010db2 (patch)
tree0bdd7490110da5e30edf7151f9949e67bff07e92 /demux
parentce861c9f33fa17d2c9be64eb9e90b22a64dfd5a4 (diff)
downloadmpv-b0f7a26f1a6dc061db0a60908842371e7a010db2.tar.bz2
mpv-b0f7a26f1a6dc061db0a60908842371e7a010db2.tar.xz
network: fix rtsp playback
By default, libavformat uses UDP for rtsp playback. This doesn't work very well. Apparently the reason is that the buffer sizes libavformat chooses for UDP are way too small, and switching to TCP gets rid of this issue entirely (thanks go to Reimar Döffinger for figuring this out). In theory, you can set buffer sizes as libavformat options, but that doesn't seem to help. Add an option to select the rtsp transport, and make TCP the default. Also remove an outdated comment from stream.c.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_lavf.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index dbe16a76b9..1e071f20e2 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -603,12 +603,33 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check)
avfc->pb = priv->pb;
}
- if (avformat_open_input(&avfc, priv->filename, priv->avif, NULL) < 0) {
+ AVDictionary *dopts = NULL;
+
+ if (matches_avinputformat_name(priv, "rtsp")) {
+ const char *transport = NULL;
+ switch (opts->network_rtsp_transport) {
+ case 1: transport = "udp"; break;
+ case 2: transport = "tcp"; break;
+ case 3: transport = "http"; break;
+ }
+ if (transport)
+ av_dict_set(&dopts, "rtsp_transport", transport, 0);
+ }
+
+ if (avformat_open_input(&avfc, priv->filename, priv->avif, &dopts) < 0) {
mp_msg(MSGT_HEADER, MSGL_ERR,
"LAVF_header: avformat_open_input() failed\n");
+ av_dict_free(&dopts);
return -1;
}
+ t = NULL;
+ while ((t = av_dict_get(dopts, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ mp_msg(MSGT_OPEN, MSGL_V, "[lavf] Could not set demux option %s=%s\n",
+ t->key, t->value);
+ }
+ av_dict_free(&dopts);
+
priv->avfc = avfc;
if (avformat_find_stream_info(avfc, NULL) < 0) {
mp_msg(MSGT_HEADER, MSGL_ERR,