mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
audioutilsprivate: Don't try to load avrt for UWP application
All APIs in avrt.h are desktop only. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/763>
This commit is contained in:
parent
26a88fdb7a
commit
f0a9907097
1 changed files with 34 additions and 19 deletions
|
@ -222,7 +222,6 @@ exit:
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
HMODULE dll;
|
HMODULE dll;
|
||||||
gboolean tried_loading;
|
|
||||||
|
|
||||||
FARPROC AvSetMmThreadCharacteristics;
|
FARPROC AvSetMmThreadCharacteristics;
|
||||||
FARPROC AvRevertMmThreadCharacteristics;
|
FARPROC AvRevertMmThreadCharacteristics;
|
||||||
|
@ -234,29 +233,45 @@ static gboolean
|
||||||
__gst_audio_init_thread_priority (void)
|
__gst_audio_init_thread_priority (void)
|
||||||
{
|
{
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
if (_gst_audio_avrt_tbl.tried_loading)
|
static gsize init_once = 0;
|
||||||
return _gst_audio_avrt_tbl.dll != NULL;
|
static gboolean ret = FALSE;
|
||||||
|
|
||||||
if (!_gst_audio_avrt_tbl.dll)
|
if (g_once_init_enter (&init_once)) {
|
||||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
_gst_audio_avrt_tbl.dll = LoadPackagedLibrary (TEXT ("avrt.dll"), 0);
|
|
||||||
#else
|
|
||||||
_gst_audio_avrt_tbl.dll = LoadLibrary (TEXT ("avrt.dll"));
|
_gst_audio_avrt_tbl.dll = LoadLibrary (TEXT ("avrt.dll"));
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_gst_audio_avrt_tbl.dll) {
|
if (!_gst_audio_avrt_tbl.dll) {
|
||||||
GST_WARNING ("Failed to set thread priority, can't find avrt.dll");
|
GST_WARNING ("Failed to set thread priority, can't find avrt.dll");
|
||||||
_gst_audio_avrt_tbl.tried_loading = TRUE;
|
goto done;
|
||||||
return FALSE;
|
}
|
||||||
|
|
||||||
|
_gst_audio_avrt_tbl.AvSetMmThreadCharacteristics =
|
||||||
|
GetProcAddress (_gst_audio_avrt_tbl.dll,
|
||||||
|
"AvSetMmThreadCharacteristicsA");
|
||||||
|
if (!_gst_audio_avrt_tbl.AvSetMmThreadCharacteristics) {
|
||||||
|
GST_WARNING ("Cannot load AvSetMmThreadCharacteristicsA symbol");
|
||||||
|
FreeLibrary (_gst_audio_avrt_tbl.dll);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
_gst_audio_avrt_tbl.AvRevertMmThreadCharacteristics =
|
||||||
|
GetProcAddress (_gst_audio_avrt_tbl.dll,
|
||||||
|
"AvRevertMmThreadCharacteristics");
|
||||||
|
|
||||||
|
if (!_gst_audio_avrt_tbl.AvRevertMmThreadCharacteristics) {
|
||||||
|
GST_WARNING ("Cannot load AvRevertMmThreadCharacteristics symbol");
|
||||||
|
FreeLibrary (_gst_audio_avrt_tbl.dll);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
done:
|
||||||
|
#endif
|
||||||
|
g_once_init_leave (&init_once, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gst_audio_avrt_tbl.AvSetMmThreadCharacteristics =
|
return ret;
|
||||||
GetProcAddress (_gst_audio_avrt_tbl.dll, "AvSetMmThreadCharacteristicsA");
|
|
||||||
_gst_audio_avrt_tbl.AvRevertMmThreadCharacteristics =
|
|
||||||
GetProcAddress (_gst_audio_avrt_tbl.dll,
|
|
||||||
"AvRevertMmThreadCharacteristics");
|
|
||||||
|
|
||||||
_gst_audio_avrt_tbl.tried_loading = TRUE;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue