This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 95391352b50b272e13c49353bf1d62b6b77d6a54 Author: Niklas Haas <[email protected]> AuthorDate: Fri May 15 18:04:57 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Sat May 23 08:41:12 2026 +0000 fftools/thread_queue: add THREAD_QUEUE_FLAG_NO_BLOCK Exactly what it says on the tin. There is some ambiguity as to whether this should also prevent reading from *choked*, as opposed to empty queue, but I think it makes sense to consider them equivalent, as I struggle to think of a use case where it would be beneficial to allow draining a queue that was explicitly choked by the upstream (to e.g. prevent further reads). Sponsored-by: nxtedition AB Signed-off-by: Niklas Haas <[email protected]> --- fftools/thread_queue.c | 2 +- fftools/thread_queue.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fftools/thread_queue.c b/fftools/thread_queue.c index 7568957a9c..9fa8a46cac 100644 --- a/fftools/thread_queue.c +++ b/fftools/thread_queue.c @@ -211,7 +211,7 @@ int tq_receive(ThreadQueue *tq, int *stream_idx, void *data, int flags) if (can_read != av_container_fifo_can_read(tq->fifo)) pthread_cond_broadcast(&tq->cond); - if (ret == AVERROR(EAGAIN)) { + if (ret == AVERROR(EAGAIN) && !(flags & THREAD_QUEUE_FLAG_NO_BLOCK)) { pthread_cond_wait(&tq->cond, &tq->lock); continue; } diff --git a/fftools/thread_queue.h b/fftools/thread_queue.h index 54de2b0845..756545df44 100644 --- a/fftools/thread_queue.h +++ b/fftools/thread_queue.h @@ -26,6 +26,12 @@ enum ThreadQueueType { THREAD_QUEUE_PACKETS, }; +enum ThreadQueueFlags { + /* When set, tq_receive() will return AVERROR(EAGAIN) instead of blocking + * when the queue is empty or choked. */ + THREAD_QUEUE_FLAG_NO_BLOCK = (1 << 0), +}; + typedef struct ThreadQueue ThreadQueue; /** @@ -74,7 +80,7 @@ void tq_choke(ThreadQueue *tq, int choked); * written here * @param data the data item will be written here on success using the * callback provided to tq_alloc() - * @param flags currently unused + * @param flags combination of THREAD_QUEUE_FLAG_* * * @return * - 0 a data item was successfully read; *stream_idx contains a non-negative _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
