real-time buffer too full or near too full问题
ffmpeger 发布于 2022-04-26

调试运行ffmpeg调用USB摄像头进行视频录制过程发现报了一个提示,[dshow @ 0000026745958400] real-time buffer [USB2.0 Camera] [video input] too full or near too full (101% of size: 3041280 [rtbufsize parameter])! frame dropped!如下图所示,

调试一直都发现这个问题,以为代码逻辑有问题,直接运行反而没有,一步一步断点调试发现在执行avcodec_open2函数之后就出现这个问题,应该是这里执行之后下面的要及时的接着运行下去才不会提示这个问题,这个提示的源码在dshow.c文件中,函数代码如下

static int shall_we_drop(AVFormatContext *s, int index, enum dshowDeviceType devtype)
{
    struct dshow_ctx *ctx = s->priv_data;
    static const uint8_t dropscore[] = {62, 75, 87, 100};
    const int ndropscores = FF_ARRAY_ELEMS(dropscore);
    unsigned int buffer_fullness = (ctx->curbufsize[index]*100)/s->max_picture_buffer;
    const char *devtypename = (devtype == VideoDevice) ? "video" : "audio";

    if(dropscore[++ctx->video_frame_num%ndropscores] <= buffer_fullness) {
        av_log(s, AV_LOG_ERROR,
              "real-time buffer [%s] [%s input] too full or near too full (%d%% of size: %d [rtbufsize parameter])! frame dropped!\n",
              ctx->device_name[devtype], devtypename, buffer_fullness, s->max_picture_buffer);
        return 1;
    }

    return 0;
}
ffmpeger
关注 私信
文章
63
关注
0
粉丝
0