[FFmpeg-devel] (no subject)

Janne Grunau janne-ffmpeg
Thu Sep 10 22:03:52 CEST 2009


Hi,

use av_fifo_space instead of av_fifo_size with known alloction size.

Janne

diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index c87697d..a385782 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -251,7 +251,7 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st,
         for (i = 0; i < c->n_ast && st != c->ast[i]; i++);
 
           /* FIXME: we have to have more sensible approach than this one */
-        if (av_fifo_size(c->audio_data[i]) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
+        if (av_fifo_space(c->audio_data[i]) < data_size)
             av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
         av_fifo_generic_write(c->audio_data[i], data, data_size, NULL);
 
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index 60b7171..0667bfc 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -446,7 +446,7 @@ static int swf_write_audio(AVFormatContext *s,
     if (swf->swf_frame_number == 16000)
         av_log(enc, AV_LOG_INFO, "warning: Flash Player limit of 16000 frames reached\n");
 
-    if (av_fifo_size(swf->audio_fifo) + size > AUDIO_FIFO_SIZE) {
+    if (av_fifo_space(swf->audio_fifo) < size) {
         av_log(s, AV_LOG_ERROR, "audio fifo too small to mux audio essence\n");
         return -1;
     }



More information about the ffmpeg-devel mailing list