[FFmpeg-cvslog] sink_buffer: warn when there are too many buffers.

Nicolas George git at videolan.org
Thu Jun 28 21:17:32 CEST 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Thu Jun 28 11:21:42 2012 +0200| [fcf8706ed9f74f056b64468d2901cb4a9de7d19e] | committer: Nicolas George

sink_buffer: warn when there are too many buffers.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcf8706ed9f74f056b64468d2901cb4a9de7d19e
---

 libavfilter/sink_buffer.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavfilter/sink_buffer.c b/libavfilter/sink_buffer.c
index 85fbee2..4db874f 100644
--- a/libavfilter/sink_buffer.c
+++ b/libavfilter/sink_buffer.c
@@ -56,6 +56,7 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void)
 
 typedef struct {
     AVFifoBuffer *fifo;                      ///< FIFO buffer of video frame references
+    unsigned warning_limit;
 
     /* only used for video */
     enum PixelFormat *pixel_fmts;           ///< list of accepted pixel formats, must be terminated with -1
@@ -76,6 +77,7 @@ static av_cold int common_init(AVFilterContext *ctx)
         av_log(ctx, AV_LOG_ERROR, "Failed to allocate fifo\n");
         return AVERROR(ENOMEM);
     }
+    buf->warning_limit = 100;
     return 0;
 }
 
@@ -113,6 +115,14 @@ static void end_frame(AVFilterLink *inlink)
     /* cache frame */
     av_fifo_generic_write(buf->fifo,
                           &inlink->cur_buf, sizeof(AVFilterBufferRef *), NULL);
+    if (buf->warning_limit &&
+        av_fifo_size(buf->fifo) / sizeof(AVFilterBufferRef *) >= buf->warning_limit) {
+        av_log(ctx, AV_LOG_WARNING,
+               "%d buffers queued in %s, something may be wrong.\n",
+               buf->warning_limit,
+               (char *)av_x_if_null(ctx->name, ctx->filter->name));
+        buf->warning_limit *= 10;
+    }
 }
 
 int av_buffersink_get_buffer_ref(AVFilterContext *ctx,



More information about the ffmpeg-cvslog mailing list