Index: libavcodec/libmp3lame.c
===================================================================
--- libavcodec/libmp3lame.c     (リビジョン 16716)
+++ libavcodec/libmp3lame.c     (作業コピー)
@@ -34,6 +34,7 @@
     int stereo;
     uint8_t buffer[BUFFER_SIZE];
     int buffer_index;
+    int buffer_flushed;
 } Mp3AudioContext;

 static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
@@ -73,6 +74,8 @@
     avctx->coded_frame= avcodec_alloc_frame();
     avctx->coded_frame->key_frame= 1;

+    s->buffer_flushed = 0;
+
     return 0;

 err_close:
@@ -166,13 +169,15 @@
                 BUFFER_SIZE - s->buffer_index
                 );
         }
-    }else{
+    }else if(data == NULL && s->buffer_flushed == 0){
         lame_result= lame_encode_flush(
                 s->gfp,
                 s->buffer + s->buffer_index,
                 BUFFER_SIZE - s->buffer_index
                 );
-    }
+        s->buffer_flushed = 1;
+    }else
+        lame_result = 0;

     if(lame_result < 0){
         if(lame_result==-1) {