GstEnginePipeline: Fix file descriptor exhaustion by using shared thread pool

Replace per-pipeline QThreadPool with a shared static pool to prevent
file descriptor and thread exhaustion. Each GstEnginePipeline was creating
its own thread pool, leading to resource accumulation during frequent
pipeline creation/destruction (track changes, seeking, crossfade).

The shared pool is limited to 2 threads max since state changes are
typically sequential per pipeline. This prevents the crash in g_wakeup_new()
when creating eventfd for new thread event dispatchers.

Fixes #1687
This commit is contained in:
Jonas Kvinge
2025-12-18 19:58:23 +01:00
parent 1d03bb2178
commit c684a95f89
2 changed files with 21 additions and 2 deletions

View File

@@ -215,7 +215,8 @@ class GstEnginePipeline : public QObject {
static int sId;
mutex_protected<int> id_;
QThreadPool set_state_threadpool_;
// Shared thread pool for all pipeline state changes to prevent thread/FD exhaustion
static QThreadPool *shared_state_threadpool();
bool playbin3_support_;
bool volume_full_range_support_;