aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-10-18 18:31:10 +0200
committerAnton Khirnov <anton@khirnov.net>2022-10-24 02:00:31 +0200
commit5f82447dfc4df8540ab52534dafb5fbd5aa99497 (patch)
tree4445817ad4253743593b644703af95ce4d5f81aa
parentf66e7946724a102c67bf03faaca7517d8ee2fcd9 (diff)
downloadffmpeg-5f82447dfc4df8540ab52534dafb5fbd5aa99497.tar.gz
lavc/pthread_frame: set worker thread names
-rw-r--r--libavcodec/pthread_frame.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index f8fddc5e4d..df82a4125f 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -179,6 +179,17 @@ static void async_unlock(FrameThreadContext *fctx)
pthread_mutex_unlock(&fctx->async_mutex);
}
+static void thread_set_name(PerThreadContext *p)
+{
+ AVCodecContext *avctx = p->avctx;
+ int idx = p - p->parent->threads;
+ char name[16];
+
+ snprintf(name, sizeof(name), "av:%.7s:df%d", avctx->codec->name, idx);
+
+ ff_thread_setname(name);
+}
+
/**
* Codec worker thread.
*
@@ -192,6 +203,8 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
AVCodecContext *avctx = p->avctx;
const FFCodec *codec = ffcodec(avctx->codec);
+ thread_set_name(p);
+
pthread_mutex_lock(&p->mutex);
while (1) {
while (atomic_load(&p->state) == STATE_INPUT_READY && !p->die)