[FFmpeg-cvslog] r24794 - in trunk/libavformat: mms.c mms.h mmst.c

rbultje subversion
Fri Aug 13 19:30:02 CEST 2010


Author: rbultje
Date: Fri Aug 13 19:30:01 2010
New Revision: 24794

Log:
Remove use of MAX_STREAMS in MMSContext->streams[] array. Instead, dynamically
allocate the array.

Modified:
   trunk/libavformat/mms.c
   trunk/libavformat/mms.h
   trunk/libavformat/mmst.c

Modified: trunk/libavformat/mms.c
==============================================================================
--- trunk/libavformat/mms.c	Fri Aug 13 19:08:57 2010	(r24793)
+++ trunk/libavformat/mms.c	Fri Aug 13 19:30:01 2010	(r24794)
@@ -99,6 +99,9 @@ int ff_mms_asf_header_parser(MMSContext 
             //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 {

Modified: trunk/libavformat/mms.h
==============================================================================
--- trunk/libavformat/mms.h	Fri Aug 13 19:08:57 2010	(r24793)
+++ trunk/libavformat/mms.h	Fri Aug 13 19:30:01 2010	(r24794)
@@ -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);

Modified: trunk/libavformat/mmst.c
==============================================================================
--- trunk/libavformat/mmst.c	Fri Aug 13 19:08:57 2010	(r24793)
+++ trunk/libavformat/mmst.c	Fri Aug 13 19:30:01 2010	(r24794)
@@ -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);
 



More information about the ffmpeg-cvslog mailing list