summaryrefslogtreecommitdiffstats
path: root/libavformat/rtsp.c
diff options
context:
space:
mode:
authorAndrey Utkin <andrey.utkin@corp.bluecherry.net>2014-03-04 15:43:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-03-04 22:54:13 +0100
commitbc764d786fe6d6eda2e1621acfaa08b8aebb0cac (patch)
tree29ab3a8e32255d461a53a57538213a3147d0e892 /libavformat/rtsp.c
parent206167a295a5c28cec3c38f7308835b0b7e0618f (diff)
downloadffmpeg-streaming-bc764d786fe6d6eda2e1621acfaa08b8aebb0cac.zip
ffmpeg-streaming-bc764d786fe6d6eda2e1621acfaa08b8aebb0cac.tar.gz
Add "prefer_tcp" flag to "rtsp_flags"
If set, and if TCP is available as RTSP RTP transport, then TCP will be tried first as RTP transport. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r--libavformat/rtsp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 82ae3bd..d89af62 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -86,6 +86,7 @@ const AVOption ff_rtsp_options[] = {
{ "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {.i64 = (1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" },
RTSP_FLAG_OPTS("rtsp_flags", "set RTSP flags"),
{ "listen", "wait for incoming connections", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_LISTEN}, 0, 0, DEC, "rtsp_flags" },
+ { "prefer_tcp", "try RTP via TCP first, if available", 0, AV_OPT_TYPE_CONST, {.i64 = RTSP_FLAG_PREFER_TCP}, 0, 0, DEC|ENC, "rtsp_flags" },
RTSP_MEDIATYPE_OPTS("allowed_media_types", "set media types to accept from the server"),
{ "min_port", "set minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC },
{ "max_port", "set maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC },
@@ -1766,6 +1767,10 @@ redirect:
int lower_transport = ff_log2_tab[lower_transport_mask &
~(lower_transport_mask - 1)];
+ if ((lower_transport_mask & (1 << RTSP_LOWER_TRANSPORT_TCP))
+ && (rt->rtsp_flags & RTSP_FLAG_PREFER_TCP))
+ lower_transport = RTSP_LOWER_TRANSPORT_TCP;
+
err = ff_rtsp_make_setup_request(s, host, port, lower_transport,
rt->server_type == RTSP_SERVER_REAL ?
real_challenge : NULL);
OpenPOWER on IntegriCloud