[PATCH 4/4] winegstreamer: Enable wg_parser streams on creation.

Zebediah Figura zfigura at codeweavers.com
Fri Apr 8 12:11:09 CDT 2022


This patch is motivated by Obduction, which creates a Media Foundation source
and leaves it open arbitrarily long before actually reading samples from it.
Without this patch, we unnecessarily waste CPU, and may reduce graphical
performance by taking CPU time that would otherwise be used on
performance-critical threads.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/winegstreamer/wg_parser.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 9b3a5ca796d..48b88a4b11c 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -1293,6 +1293,13 @@ static NTSTATUS wg_parser_connect(void *args)
                 pthread_cond_wait(&parser->init_cond, &parser->mutex);
             }
         }
+
+        /* Now that we're fully initialized, enable the stream so that further
+         * samples get queued instead of being discarded. We don't actually need
+         * the samples (in particular, the frontend should seek before
+         * attempting to read anything), but we don't want to waste CPU time
+         * trying to decode them. */
+        stream->enabled = true;
     }
 
     pthread_mutex_unlock(&parser->mutex);
-- 
2.35.1




More information about the wine-devel mailing list