Commit 48cb107d31 for ffmpeg
commit 48cb107d31a23eea6bf5618a2003aa682cbd36f7
Author: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Date: Sat Nov 7 19:14:27 2026 -0800
avfilter/f_select: print the debug line with one av_log() call
Output from other filter graph threads could land inside the line;
compute select_out first and print the line at once.
Signed-off-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 2548e1bcc9..bd262e6b8a 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -385,39 +385,47 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame)
}
select->select = res = av_expr_eval(select->expr, select->var_values, NULL);
- av_log(inlink->dst, AV_LOG_DEBUG,
- "n:%f pts:%f t:%f key:%d",
- select->var_values[VAR_N],
- select->var_values[VAR_PTS],
- select->var_values[VAR_T],
- !!(frame->flags & AV_FRAME_FLAG_KEY));
+
+ if (res == 0) {
+ select->select_out = -1; /* drop */
+ } else if (isnan(res) || res < 0) {
+ select->select_out = 0; /* first output */
+ } else {
+ unsigned u = ceil(FFMIN(res, select->nb_outputs));
+ select->select_out = FFMIN(u-1, select->nb_outputs-1); /* other outputs */
+ }
switch (inlink->type) {
case AVMEDIA_TYPE_VIDEO:
- av_log(inlink->dst, AV_LOG_DEBUG, " interlace_type:%c pict_type:%c scene:%f",
+ av_log(inlink->dst, AV_LOG_DEBUG,
+ "n:%f pts:%f t:%f key:%d"
+ " interlace_type:%c pict_type:%c scene:%f"
+ " -> select:%f select_out:%d\n",
+ select->var_values[VAR_N],
+ select->var_values[VAR_PTS],
+ select->var_values[VAR_T],
+ !!(frame->flags & AV_FRAME_FLAG_KEY),
!(frame->flags & AV_FRAME_FLAG_INTERLACED) ? 'P' :
(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? 'T' : 'B',
av_get_picture_type_char(frame->pict_type),
- select->var_values[VAR_SCENE]);
+ select->var_values[VAR_SCENE],
+ res, select->select_out);
break;
case AVMEDIA_TYPE_AUDIO:
- av_log(inlink->dst, AV_LOG_DEBUG, " samples_n:%d consumed_samples_n:%f",
+ av_log(inlink->dst, AV_LOG_DEBUG,
+ "n:%f pts:%f t:%f key:%d"
+ " samples_n:%d consumed_samples_n:%f"
+ " -> select:%f select_out:%d\n",
+ select->var_values[VAR_N],
+ select->var_values[VAR_PTS],
+ select->var_values[VAR_T],
+ !!(frame->flags & AV_FRAME_FLAG_KEY),
frame->nb_samples,
- select->var_values[VAR_CONSUMED_SAMPLES_N]);
+ select->var_values[VAR_CONSUMED_SAMPLES_N],
+ res, select->select_out);
break;
}
- if (res == 0) {
- select->select_out = -1; /* drop */
- } else if (isnan(res) || res < 0) {
- select->select_out = 0; /* first output */
- } else {
- unsigned u = ceil(FFMIN(res, select->nb_outputs));
- select->select_out = FFMIN(u-1, select->nb_outputs-1); /* other outputs */
- }
-
- av_log(inlink->dst, AV_LOG_DEBUG, " -> select:%f select_out:%d\n", res, select->select_out);
-
if (res) {
select->var_values[VAR_PREV_SELECTED_N] = select->var_values[VAR_N];
select->var_values[VAR_PREV_SELECTED_PTS] = select->var_values[VAR_PTS];