[MPlayer-cvslog] r29953 - trunk/libmpdemux/demux_lavf.c

reimar subversion at mplayerhq.hu
Sun Nov 22 14:06:44 CET 2009


Author: reimar
Date: Sun Nov 22 14:06:44 2009
New Revision: 29953

Log:
Reuse buffer in priv context instead of allocating the 32kB probe buffer
on the stack.

Modified:
   trunk/libmpdemux/demux_lavf.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sun Nov 22 01:22:24 2009	(r29952)
+++ trunk/libmpdemux/demux_lavf.c	Sun Nov 22 14:06:44 2009	(r29953)
@@ -67,7 +67,7 @@ typedef struct lavf_priv_t{
     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 void list_formats(void) {
 
 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 @@ static int lavf_check_file(demuxer_t *de
         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);


More information about the MPlayer-cvslog mailing list