Module: wine
Branch: master
Commit: 94fd0561b740dbb94608a8c4b3e1283e345e8c7a
URL: https://gitlab.winehq.org/wine/wine/-/commit/94fd0561b740dbb94608a8c4b3e128…
Author: Brendan McGrath <bmcgrath(a)codeweavers.com>
Date: Wed Jun 26 12:22:24 2024 +1000
winegstreamer: Set 'max_threads' to 4 for 32-bit processors.
The avdec_h264 element can use 32MB per thread when working with 4K video.
With 16 threads, this is 512MB, which is a quarter of the RAM available
to a 32-bit application. Setting 'max_threads' to 4 can save 384MB.
---
dlls/winegstreamer/unixlib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/unixlib.c b/dlls/winegstreamer/unixlib.c
index 3558cf45423..729008e1f46 100644
--- a/dlls/winegstreamer/unixlib.c
+++ b/dlls/winegstreamer/unixlib.c
@@ -326,12 +326,12 @@ void set_max_threads(GstElement *element)
* of RAM each (w * h * bpp).
*
* So we will instead explictly set 'max-threads' to the minimum of thread_count (process affinity at time of
- * initialization) or 16.
+ * initialization) or 16 (4 for 32-bit processors).
*/
if (shortname && strstr(shortname, "avdec_") && element_has_property(element, "max-threads"))
{
- gint32 max_threads = MIN(thread_count, 16);
+ gint32 max_threads = MIN(thread_count, sizeof(void *) == 4 ? 4 : 16);
GST_DEBUG("%s found, setting max-threads to %d.", shortname, max_threads);
g_object_set(element, "max-threads", max_threads, NULL);
}