[FFmpeg-devel] [PATCH] Playout to DeckLink will wait for all buffered frames before stopping.

Marton Balint cus at passwd.hu
Tue Jul 8 23:11:53 EEST 2025



On Tue, 8 Jul 2025, Devin Heitmueller wrote:

> On Tue, Jul 8, 2025 at 1:08 PM Marvin Scholz
> <epirat07-at-gmail.com at ffmpeg.org> wrote:
>> What about a drain_timeout option? This could then solve all the
>> mentioned cases. We could have it default to something like 1000ms,
>> and for your use-case you could set it to 0, to not drain at all?
>
> I have no objection to that approach.
>

Ok, but instead of sleeping you should use something like this:

pthread_mutex_lock(&ctx->mutex);
while (ctx->frames_buffer_available_spots < ctx->frame_buffer) {
     pthread_cond_wait(&ctx->cond, &ctx->mutex);
}
pthread_mutex_unlock(&ctx->mutex);

If you want an adjustable timeout you can use pthread_cond_timedwait().

Regards,
Marton


More information about the ffmpeg-devel mailing list