From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 92AFC47B02 for ; Wed, 31 Jan 2024 04:19:57 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AE8CF68D0B1; Wed, 31 Jan 2024 06:19:53 +0200 (EET) Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0303268C7B6 for ; Wed, 31 Jan 2024 06:19:46 +0200 (EET) Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4TPpht6v89z9sRg for ; Wed, 31 Jan 2024 05:19:42 +0100 (CET) Message-ID: <0f7505b9-91aa-4e1f-a3b1-90301ce913c8@gyani.pro> Date: Wed, 31 Jan 2024 09:49:40 +0530 MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org References: <20240126140917.11368-1-ffmpeg@gyani.pro> Content-Language: en-US From: Gyan Doshi In-Reply-To: <20240126140917.11368-1-ffmpeg@gyani.pro> X-Rspamd-Queue-Id: 4TPpht6v89z9sRg Subject: Re: [FFmpeg-devel] [PATCH] avfilter/buffersrc: limit link variance logs below debug loglevel X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2024-01-26 07:39 pm, Gyan Doshi wrote: > The video param change check will print loglines below debug level > for each frame which is different from the inlink parameters. This > can spam the console. It is now printed at warning level once for > each param change else it is kept at debug level. > > Partially addresses #10823 Plan to push tomorrow. Regards, Gyan > --- > libavfilter/buffersrc.c | 40 +++++++++++++++++++++++++++------------- > 1 file changed, 27 insertions(+), 13 deletions(-) > > diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c > index afe69433b2..6e450ff6b7 100644 > --- a/libavfilter/buffersrc.c > +++ b/libavfilter/buffersrc.c > @@ -49,10 +49,10 @@ typedef struct BufferSourceContext { > unsigned nb_failed_requests; > > /* video only */ > - int w, h; > - enum AVPixelFormat pix_fmt; > - enum AVColorSpace color_space; > - enum AVColorRange color_range; > + int w, h, prev_w, prev_h; > + enum AVPixelFormat pix_fmt, prev_pix_fmt; > + enum AVColorSpace color_space, prev_color_space; > + enum AVColorRange color_range, prev_color_range; > AVRational pixel_aspect; > > AVBufferRef *hw_frames_ctx; > @@ -66,16 +66,30 @@ typedef struct BufferSourceContext { > > int eof; > int64_t last_pts; > + int link_delta, prev_delta; > } BufferSourceContext; > > #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format, csp, range, pts)\ > - if (c->w != width || c->h != height || c->pix_fmt != format ||\ > - c->color_space != csp || c->color_range != range) {\ > - av_log(s, AV_LOG_INFO, "filter context - w: %d h: %d fmt: %d csp: %s range: %s, incoming frame - w: %d h: %d fmt: %d csp: %s range: %s pts_time: %s\n",\ > + c->link_delta = c->w != width || c->h != height || c->pix_fmt != format ||\ > + c->color_space != csp || c->color_range != range;\ > + c->prev_delta = c->prev_w != width || c->prev_h != height || c->prev_pix_fmt != format ||\ > + c->prev_color_space != csp || c->prev_color_range != range;\ > + if (c->link_delta) {\ > + int loglevel = c->prev_delta ? AV_LOG_WARNING : AV_LOG_DEBUG;\ > + av_log(s, loglevel, "Changing video frame properties on the fly is not supported by all filters.\n");\ > + av_log(s, loglevel, "filter context - w: %d h: %d fmt: %d csp: %s range: %s, incoming frame - w: %d h: %d fmt: %d csp: %s range: %s pts_time: %s\n",\ > c->w, c->h, c->pix_fmt, av_color_space_name(c->color_space), av_color_range_name(c->color_range),\ > width, height, format, av_color_space_name(csp), av_color_range_name(range),\ > av_ts2timestr(pts, &s->outputs[0]->time_base));\ > - av_log(s, AV_LOG_WARNING, "Changing video frame properties on the fly is not supported by all filters.\n");\ > + }\ > + if (c->prev_delta) {\ > + if (!c->link_delta)\ > + av_log(s, AV_LOG_VERBOSE, "video frame properties congruent with link at pts_time: %s\n", av_ts2timestr(pts, &s->outputs[0]->time_base));\ > + c->prev_w = width;\ > + c->prev_h = height;\ > + c->prev_pix_fmt = format;\ > + c->prev_color_space = csp;\ > + c->prev_color_range = range;\ > } > > #define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, layout, format, pts)\ > @@ -111,12 +125,12 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *par > switch (ctx->filter->outputs[0].type) { > case AVMEDIA_TYPE_VIDEO: > if (param->format != AV_PIX_FMT_NONE) { > - s->pix_fmt = param->format; > + s->pix_fmt = s->prev_pix_fmt = param->format; > } > if (param->width > 0) > - s->w = param->width; > + s->w = s->prev_w = param->width; > if (param->height > 0) > - s->h = param->height; > + s->h = s->prev_h = param->height; > if (param->sample_aspect_ratio.num > 0 && param->sample_aspect_ratio.den > 0) > s->pixel_aspect = param->sample_aspect_ratio; > if (param->frame_rate.num > 0 && param->frame_rate.den > 0) > @@ -128,9 +142,9 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *par > return AVERROR(ENOMEM); > } > if (param->color_space != AVCOL_SPC_UNSPECIFIED) > - s->color_space = param->color_space; > + s->color_space = s->prev_color_space = param->color_space; > if (param->color_range != AVCOL_RANGE_UNSPECIFIED) > - s->color_range = param->color_range; > + s->color_range = s->prev_color_range = param->color_range; > break; > case AVMEDIA_TYPE_AUDIO: > if (param->format != AV_SAMPLE_FMT_NONE) { _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".