[FFmpeg-devel] [PATCH 2/6] mpegts: change variable-length array to fixed length

Mans Rullgard mans
Wed Aug 19 03:22:58 CEST 2009


The difference between 188 and 204 is not worth worrying about.
---
 libavformat/mpegts.c |    2 +-
 libavformat/mpegts.h |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 6c0c314..69623ac 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -355,7 +355,7 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
 }
 
 static int analyze(const uint8_t *buf, int size, int packet_size, int *index){
-    int stat[packet_size];
+    int stat[TS_MAX_PACKET_SIZE];
     int i;
     int x=0;
     int best_score=0;
diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index e5df071..7c4e73c 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -27,6 +27,8 @@
 #define TS_FEC_PACKET_SIZE 204
 #define TS_DVHS_PACKET_SIZE 192
 #define TS_PACKET_SIZE 188
+#define TS_MAX_PACKET_SIZE 204
+
 #define NB_PID_MAX 8192
 #define MAX_SECTION_SIZE 4096
 
-- 
1.6.4




More information about the ffmpeg-devel mailing list