aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2010-08-13 17:30:01 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-08-13 17:30:01 +0000
commit67197656d19fa9e084e47b5331c262a9c7842335 (patch)
tree11626b91effab046306a041f0584880416511386
parentc46000c1ff570f30f2255dcb42950b464a219a3d (diff)
downloadffmpeg-67197656d19fa9e084e47b5331c262a9c7842335.tar.gz
Remove use of MAX_STREAMS in MMSContext->streams[] array. Instead, dynamically
allocate the array. Originally committed as revision 24794 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/mms.c3
-rw-r--r--libavformat/mms.h3
-rw-r--r--libavformat/mmst.c1
3 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/mms.c b/libavformat/mms.c
index cbb4739aca..73f4e6b671 100644
--- a/libavformat/mms.c
+++ b/libavformat/mms.c
@@ -99,6 +99,9 @@ int ff_mms_asf_header_parser(MMSContext *mms)
//Please see function send_stream_selection_request().
if (mms->stream_num < MAX_STREAMS &&
46 + mms->stream_num * 6 < sizeof(mms->out_buffer)) {
+ mms->streams = av_fast_realloc(mms->streams,
+ &mms->nb_streams_allocated,
+ (mms->stream_num + 1) * sizeof(MMSStream));
mms->streams[mms->stream_num].id = stream_id;
mms->stream_num++;
} else {
diff --git a/libavformat/mms.h b/libavformat/mms.h
index 675d6b93ee..7ee0485204 100644
--- a/libavformat/mms.h
+++ b/libavformat/mms.h
@@ -29,7 +29,7 @@ typedef struct {
typedef struct {
URLContext *mms_hd; ///< TCP connection handle
- MMSStream streams[MAX_STREAMS];
+ MMSStream *streams;
/** Buffer for outgoing packets. */
/*@{*/
@@ -54,6 +54,7 @@ typedef struct {
/*@}*/
int stream_num; ///< stream numbers.
+ unsigned int nb_streams_allocated; ///< allocated size of streams
} MMSContext;
int ff_mms_asf_header_parser(MMSContext * mms);
diff --git a/libavformat/mmst.c b/libavformat/mmst.c
index ccfc212b1f..3d12d82b73 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -468,6 +468,7 @@ static int mms_close(URLContext *h)
}
/* free all separately allocated pointers in mms */
+ av_free(mms->streams);
av_free(mms->asf_header);
av_freep(&h->priv_data);