From b1dd20d57a9356ba60159d589328db8839811677 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 9 Jun 2021 23:29:43 +0900 Subject: [PATCH] wasapi2: Increase rank to primary + 1 wasapi2 plugin should be preferred than old wasapi plugin if available because: * wasapi2 supports automatic stream routing, and it's highly recommended feature for application by MS. See also https://docs.microsoft.com/en-us/windows/win32/coreaudio/automatic-stream-routing * This implementation must be various COM threading issue free by design since wasapi2 plugin spawns a new dedicated COM thread and all COM objects' life-cycles are managed correctly. There are unsolved COM issues around old wasapi plugin. Such issues are very tricky to be solved unless old wasapi plugin's threading model is re-designed. Note that, in case of UWP, wasapi2 plugin's rank is primary + 1 already Part-of: --- sys/wasapi2/plugin.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sys/wasapi2/plugin.c b/sys/wasapi2/plugin.c index 39cdf4c148..aabeb98b29 100644 --- a/sys/wasapi2/plugin.c +++ b/sys/wasapi2/plugin.c @@ -41,7 +41,7 @@ plugin_deinit (gpointer data) static gboolean plugin_init (GstPlugin * plugin) { - GstRank rank = GST_RANK_SECONDARY; + GstRank rank = GST_RANK_PRIMARY + 1; HRESULT hr; /** @@ -55,10 +55,6 @@ plugin_init (GstPlugin * plugin) GST_WARNING ("MFStartup failure, hr: 0x%x", hr); return TRUE; } -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - /* If we are building for UWP, wasapi2 plugin should have the highest rank */ - rank = GST_RANK_PRIMARY + 1; -#endif GST_DEBUG_CATEGORY_INIT (gst_wasapi2_debug, "wasapi2", 0, "wasapi2"); GST_DEBUG_CATEGORY_INIT (gst_wasapi2_client_debug, "wasapi2client",