[FFmpeg-devel] [PATCH v2 01/27] avcodec/threadprogress: Add new API for frame-threaded progress

Anton Khirnov anton at khirnov.net
Wed Apr 10 09:38:00 EEST 2024


Quoting Andreas Rheinhardt (2024-04-08 21:51:59)
> +/**
> + * ThreadProgress is an API to easily notify other threads about progress
> + * of any kind as long as it can be packaged into an int and is consistent
> + * with the natural ordering of integers.
> + *
> + * Each initialized ThreadProgress can be in one of two modes: No-op mode
> + * or ordinary mode. In the former mode, ff_thread_report_progress() and
> + * ff_thread_await_progress() are no-ops to simply support usecases like
> + * non-frame-threading. Only in the latter case perform these functions

Maybe 'strictly serial usecases' or 'non-parallel usecases' would sound
better.

> + * what their name already implies.
> + */
> +
> +#include <limits.h>
> +#include <stdatomic.h>
> +#include "libavutil/thread.h"
> +
> +/**
> + * This struct should be treated as opaque by users.
> + */
> +typedef struct ThreadProgress {
> +    atomic_int progress;
> +    unsigned   init;
> +    AVMutex progress_mutex;
> +    AVCond  progress_cond;
> +} ThreadProgress;
> +
> +/**
> + * Initialize a ThreadProgress.
> + *
> + * @param init_mode If zero, the ThreadProgress will be initialized so that
> + *                  to be in no-op mode as described above. Otherwise

Seems like something missing here.

LGTM otherwise.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list