changeset 29911:74ebb2b03d90

Reuse buffer in priv context instead of allocating the 32kB probe buffer on the stack.
author reimar
date Sun, 22 Nov 2009 13:06:44 +0000
parents 90f1bbea45b5
children 49f3853e9105
files libmpdemux/demux_lavf.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_lavf.c	Sun Nov 22 00:22:24 2009 +0000
+++ b/libmpdemux/demux_lavf.c	Sun Nov 22 13:06:44 2009 +0000
@@ -67,7 +67,7 @@
     AVInputFormat *avif;
     AVFormatContext *avfc;
     ByteIOContext *pb;
-    uint8_t buffer[BIO_BUFFER_SIZE];
+    uint8_t buffer[FFMAX(BIO_BUFFER_SIZE, PROBE_BUF_SIZE)];
     int audio_streams;
     int video_streams;
     int sub_streams;
@@ -131,7 +131,6 @@
 
 static int lavf_check_file(demuxer_t *demuxer){
     AVProbeData avpd;
-    uint8_t buf[PROBE_BUF_SIZE];
     lavf_priv_t *priv;
     int probe_data_size;
 
@@ -155,11 +154,11 @@
         return DEMUXER_TYPE_LAVF;
     }
 
-    probe_data_size = stream_read(demuxer->stream, buf, PROBE_BUF_SIZE);
+    probe_data_size = stream_read(demuxer->stream, priv->buffer, PROBE_BUF_SIZE);
     if(probe_data_size <= 0)
         return 0;
     avpd.filename= demuxer->stream->url;
-    avpd.buf= buf;
+    avpd.buf= priv->buffer;
     avpd.buf_size= probe_data_size;
 
     priv->avif= av_probe_input_format(&avpd, 1);