From 2b33369c032b210e9ef2ece7bfdd29eef30e2f15 Mon Sep 17 00:00:00 2001
From: Dmitry Volyntsev <xeioexception@gmail.com>
Date: Wed, 18 Jan 2012 13:46:37 +0400
Subject: [PATCH 1/2] fix rtp 916 issue
---
libavformat/rtsp.c | 8 +++++---
libavformat/rtsp.h | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index d32f49e..ff1f857 100644
|
a
|
b
|
int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, |
| 1103 | 1103 | int lower_transport, const char *real_challenge) |
| 1104 | 1104 | { |
| 1105 | 1105 | RTSPState *rt = s->priv_data; |
| 1106 | | int rtx = 0, j, i, err, interleave = 0; |
| | 1106 | int rtx = 0, j, i, err, interleave = 0, port_off; |
| 1107 | 1107 | RTSPStream *rtsp_st; |
| 1108 | 1108 | RTSPMessageHeader reply1, *reply = &reply1; |
| 1109 | 1109 | char cmd[2048]; |
| … |
… |
int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, |
| 1120 | 1120 | /* for each stream, make the setup request */ |
| 1121 | 1121 | /* XXX: we assume the same server is used for the control of each |
| 1122 | 1122 | * RTSP stream */ |
| | 1123 | port_off = av_get_random_seed() % (RTSP_RTP_PORT_MAX - RTSP_RTP_PORT_MIN); |
| | 1124 | /* even random offset */ |
| | 1125 | port_off -= port_off & 0x01; |
| 1123 | 1126 | |
| 1124 | | for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) { |
| | 1127 | for (j = RTSP_RTP_PORT_MIN + port_off, i = 0; i < rt->nb_rtsp_streams; ++i) { |
| 1125 | 1128 | char transport[2048]; |
| 1126 | 1129 | |
| 1127 | 1130 | /* |
| … |
… |
int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port, |
| 1169 | 1172 | goto rtp_opened; |
| 1170 | 1173 | } |
| 1171 | 1174 | } |
| 1172 | | |
| 1173 | 1175 | av_log(s, AV_LOG_ERROR, "Unable to open an input RTP port\n"); |
| 1174 | 1176 | err = AVERROR(EIO); |
| 1175 | 1177 | goto fail; |
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 36de7e5..e11dec9 100644
|
a
|
b
|
enum RTSPControlTransport { |
| 70 | 70 | #define RTSP_DEFAULT_NB_AUDIO_CHANNELS 1 |
| 71 | 71 | #define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 |
| 72 | 72 | #define RTSP_RTP_PORT_MIN 5000 |
| 73 | | #define RTSP_RTP_PORT_MAX 10000 |
| | 73 | #define RTSP_RTP_PORT_MAX 65000 |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * This describes a single item in the "Transport:" line of one stream as |