| @@ -81,6 +81,8 @@ const AVOption ff_rtsp_options[] = { · 80 unmodified lines |
| 81 | { "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {(1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" }, | 81 | { "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {(1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" }, |
| 82 | RTSP_FLAG_OPTS("rtsp_flags", "RTSP flags"), | 82 | RTSP_FLAG_OPTS("rtsp_flags", "RTSP flags"), |
| 83 | RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"), | 83 | RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"), |
| | 84 | { "min_port", "Minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC }, |
| | 85 | { "max_port", "Maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC }, |
| 84 | { NULL }, | 86 | { NULL }, |
| 85 | }; | 87 | }; |
| 86 | | 88 | |
| @@ -1121,7 +1123,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, · 1034 unmodified lines |
| 1121 | /* XXX: we assume the same server is used for the control of each | 1123 | /* XXX: we assume the same server is used for the control of each |
| 1122 | * RTSP stream */ | 1124 | * RTSP stream */ |
| 1123 | | 1125 | |
| 1124 | for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) { | 1126 | for (j = rt->rtp_port_min, i = 0; i < rt->nb_rtsp_streams; ++i) { |
| 1125 | char transport[2048]; | 1127 | char transport[2048]; |
| 1126 | | 1128 | |
| 1127 | /* | 1129 | /* |
| @@ -1158,7 +1160,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, · 30 unmodified lines |
| 1158 | } | 1160 | } |
| 1159 | | 1161 | |
| 1160 | /* first try in specified port range */ | 1162 | /* first try in specified port range */ |
| 1161 | while (j <= RTSP_RTP_PORT_MAX) { | 1163 | while (j <= rt->rtp_port_max) { |
| 1162 | ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1, | 1164 | ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1, |
| 1163 | "?localport=%d", j); | 1165 | "?localport=%d", j); |
| 1164 | /* we will use two ports per rtp stream (rtp and rtcp) */ | 1166 | /* we will use two ports per rtp stream (rtp and rtcp) */ |
| @@ -1356,6 +1358,13 @@ int ff_rtsp_connect(AVFormatContext *s) · 191 unmodified lines |
| 1356 | struct sockaddr_storage peer; | 1358 | struct sockaddr_storage peer; |
| 1357 | socklen_t peer_len = sizeof(peer); | 1359 | socklen_t peer_len = sizeof(peer); |
| 1358 | | 1360 | |
| | 1361 | if (rt->rtp_port_max < rt->rtp_port_min) { |
| | 1362 | av_log(s, AV_LOG_ERROR, "Invalid UDP port range, max port %d less " |
| | 1363 | "than min port %d\n", rt->rtp_port_max, |
| | 1364 | rt->rtp_port_min); |
| | 1365 | return AVERROR(EINVAL); |
| | 1366 | } |
| | 1367 | |
| 1359 | if (!ff_network_init()) | 1368 | if (!ff_network_init()) |
| 1360 | return AVERROR(EIO); | 1369 | return AVERROR(EIO); |
| 1361 | | 1370 | |