summaryrefslogtreecommitdiffstats
path: root/libavformat/rtsp.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2010-08-09 23:00:13 +0000
committerAurelien Jacobs <aurel@gnuage.org>2010-08-09 23:00:13 +0000
commitbe73ba2fa4890b857d987b79958e46af8c5e545b (patch)
tree70343f2d3971b7093b02ad98c93d7f58a1091199 /libavformat/rtsp.c
parentdfdb353cd565efbd1f64105ce7519ec809ad338d (diff)
downloadffmpeg-streaming-be73ba2fa4890b857d987b79958e46af8c5e545b.zip
ffmpeg-streaming-be73ba2fa4890b857d987b79958e46af8c5e545b.tar.gz
get rid of MAX_STREAMS limit in RTSP
Originally committed as revision 24752 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r--libavformat/rtsp.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 4844e19..53051db 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1611,12 +1611,18 @@ redirect:
static int rtsp_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
+ RTSPState *rt = s->priv_data;
int ret;
ret = ff_rtsp_connect(s);
if (ret)
return ret;
+ rt->real_setup_cache = av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache));
+ if (!rt->real_setup_cache)
+ return AVERROR(ENOMEM);
+ rt->real_setup = rt->real_setup_cache + s->nb_streams * sizeof(*rt->real_setup);
+
if (ap->initial_pause) {
/* do not start immediately */
} else {
@@ -1835,13 +1841,12 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
if (rt->server_type == RTSP_SERVER_REAL) {
int i;
- enum AVDiscard cache[MAX_STREAMS];
for (i = 0; i < s->nb_streams; i++)
- cache[i] = s->streams[i]->discard;
+ rt->real_setup[i] = s->streams[i]->discard;
if (!rt->need_subscription) {
- if (memcmp (cache, rt->real_setup_cache,
+ if (memcmp (rt->real_setup, rt->real_setup_cache,
sizeof(enum AVDiscard) * s->nb_streams)) {
snprintf(cmd, sizeof(cmd),
"Unsubscribe: %s\r\n",
@@ -1857,7 +1862,7 @@ static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
if (rt->need_subscription) {
int r, rule_nr, first = 1;
- memcpy(rt->real_setup_cache, cache,
+ memcpy(rt->real_setup_cache, rt->real_setup,
sizeof(enum AVDiscard) * s->nb_streams);
rt->last_subscription[0] = 0;
@@ -1969,6 +1974,8 @@ static int rtsp_read_close(AVFormatContext *s)
ff_rtsp_close_streams(s);
ff_rtsp_close_connections(s);
ff_network_close();
+ rt->real_setup = NULL;
+ av_freep(&rt->real_setup_cache);
return 0;
}
OpenPOWER on IntegriCloud