Make av_fifo*_read() ignore the available amount of data.
[ffmpeg.git] / libavformat / mpegenc.c
index 05c72cd1e7c40f8d0f7bac12c7466363e4f7e311..c96ffd1684b533506ebe247ba31d3d700ec828eb 100644 (file)
@@ -913,8 +913,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
         }
 
         /* output data */
-        if(av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, ctx->pb) < 0)
-            return -1;
+        assert(payload_size - stuffing_size <= av_fifo_size(&stream->fifo));
+        av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, ctx->pb);
         stream->bytes_to_iframe -= payload_size - stuffing_size;
     }else{
         payload_size=