[PR] avutil/slicethread: fix build on --disable-pthreads (PR #24319)

Niklas Haas via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <[email protected]>
PR #24319 opened by Niklas Haas (haasn)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24319
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24319.patch

The ABI wrapper shim was referencing AVSliceThread directly, which is only
defined in the threaded path. Include a separate copy of wrapper functions
for the non-thread case instead.

Fixes: dab32dcc2129b80df7190cdfc1063b3940c711af
Signed-off-by: Niklas Haas <[email protected]>

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 1382b60dfcddfe80005334728f609d92146a56f9 Mon Sep 17 00:00:00 2001
From: Niklas Haas <[email protected]>
Date: Sat, 29 Aug 2026 16:23:30 +0200
Subject: [PATCH] avutil/slicethread: fix build on --disable-pthreads

The ABI wrapper shim was referencing AVSliceThread directly, which is only
defined in the threaded path. Include a separate copy of wrapper functions
for the non-thread case instead.

Fixes: dab32dcc2129b80df7190cdfc1063b3940c711af
Signed-off-by: Niklas Haas <[email protected]>
---
 libavutil/slicethread.c | 62 ++++++++++++++++++++++++++---------------
 1 file changed, 39 insertions(+), 23 deletions(-)

diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c
index 65566f0169..54733942b3 100644
--- a/libavutil/slicethread.c
+++ b/libavutil/slicethread.c
@@ -278,29 +278,6 @@ av_cold void avpriv_slicethread_free(AVSliceThread **pctx)
     av_freep(pctx);
 }
 
-#else /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
-
-int avpriv_slicethread_create2(AVSliceThread **pctx, void *priv,
-                               int (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
-                               int (*main_func)(void *priv),
-                               int nb_threads)
-{
-    *pctx = NULL;
-    return AVERROR(ENOSYS);
-}
-
-int avpriv_slicethread_execute2(AVSliceThread *ctx, int nb_jobs, int execute_main)
-{
-    av_assert0(0);
-}
-
-void avpriv_slicethread_free(AVSliceThread **pctx)
-{
-    av_assert0(!pctx || !*pctx);
-}
-
-#endif /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
-
 /**
  * Backwards compatibility wrapper for the deprecated avpriv_ slicethread API.
  */
@@ -345,3 +322,42 @@ void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_mai
 }
 
 #endif /* LIBAVUTIL_VERSION_MAJOR < 62 */
+
+#else /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
+
+int avpriv_slicethread_create2(AVSliceThread **pctx, void *priv,
+                               int (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
+                               int (*main_func)(void *priv),
+                               int nb_threads)
+{
+    *pctx = NULL;
+    return AVERROR(ENOSYS);
+}
+
+int avpriv_slicethread_execute2(AVSliceThread *ctx, int nb_jobs, int execute_main)
+{
+    av_assert0(0);
+}
+
+void avpriv_slicethread_free(AVSliceThread **pctx)
+{
+    av_assert0(!pctx || !*pctx);
+}
+
+#if LIBAVUTIL_VERSION_MAJOR < 62
+int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
+                              void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
+                              void (*main_func)(void *priv),
+                              int nb_threads)
+{
+    *pctx = NULL;
+    return AVERROR(ENOSYS);
+}
+
+void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main)
+{
+    av_assert0(0);
+}
+#endif /* LIBAVUTIL_VERSION_MAJOR < 62 */
+
+#endif /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.