Commit bf527c00 authored by Alexandre Julliard's avatar Alexandre Julliard

faudio: Import upstream release 22.01.

parent 879ccd33
...@@ -484,8 +484,8 @@ extern FAudioGUID DATAFORMAT_SUBTYPE_IEEE_FLOAT; ...@@ -484,8 +484,8 @@ extern FAudioGUID DATAFORMAT_SUBTYPE_IEEE_FLOAT;
#define FAUDIO_TARGET_VERSION 8 /* Targeting compatibility with XAudio 2.8 */ #define FAUDIO_TARGET_VERSION 8 /* Targeting compatibility with XAudio 2.8 */
#define FAUDIO_ABI_VERSION 0 #define FAUDIO_ABI_VERSION 0
#define FAUDIO_MAJOR_VERSION 21 #define FAUDIO_MAJOR_VERSION 22
#define FAUDIO_MINOR_VERSION 11 #define FAUDIO_MINOR_VERSION 1
#define FAUDIO_PATCH_VERSION 0 #define FAUDIO_PATCH_VERSION 0
#define FAUDIO_COMPILED_VERSION ( \ #define FAUDIO_COMPILED_VERSION ( \
......
...@@ -70,6 +70,44 @@ void FAudio_Log(char const *msg) ...@@ -70,6 +70,44 @@ void FAudio_Log(char const *msg)
OutputDebugStringA(msg); OutputDebugStringA(msg);
} }
static HMODULE kernelbase = NULL;
static HRESULT (WINAPI *my_SetThreadDescription)(HANDLE, PCWSTR) = NULL;
static void FAudio_resolve_SetThreadDescription(void)
{
kernelbase = LoadLibraryA("kernelbase.dll");
if (!kernelbase)
return;
my_SetThreadDescription = (HRESULT (WINAPI *)(HANDLE, PCWSTR)) GetProcAddress(kernelbase, "SetThreadDescription");
if (!my_SetThreadDescription)
{
FreeLibrary(kernelbase);
kernelbase = NULL;
}
}
static void FAudio_set_thread_name(char const *name)
{
int ret;
WCHAR *nameW;
if (!my_SetThreadDescription)
return;
ret = MultiByteToWideChar(CP_UTF8, 0, name, -1, NULL, 0);
nameW = FAudio_malloc(ret * sizeof(WCHAR));
if (!nameW)
return;
ret = MultiByteToWideChar(CP_UTF8, 0, name, -1, nameW, ret);
if (ret)
my_SetThreadDescription(GetCurrentThread(), nameW);
FAudio_free(nameW);
}
static HRESULT FAudio_FillAudioClientBuffer( static HRESULT FAudio_FillAudioClientBuffer(
struct FAudioAudioClientThreadArgs *args, struct FAudioAudioClientThreadArgs *args,
IAudioRenderClient *client, IAudioRenderClient *client,
...@@ -121,6 +159,8 @@ static DWORD WINAPI FAudio_AudioClientThread(void *user) ...@@ -121,6 +159,8 @@ static DWORD WINAPI FAudio_AudioClientThread(void *user)
HRESULT hr = S_OK; HRESULT hr = S_OK;
UINT frames, padding = 0; UINT frames, padding = 0;
FAudio_set_thread_name(__func__);
hr = IAudioClient_GetService( hr = IAudioClient_GetService(
args->client, args->client,
&IID_IAudioRenderClient, &IID_IAudioRenderClient,
...@@ -172,6 +212,7 @@ void FAudio_PlatformInit( ...@@ -172,6 +212,7 @@ void FAudio_PlatformInit(
BOOL has_sse2 = IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE); BOOL has_sse2 = IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
FAudio_INTERNAL_InitSIMDFunctions(has_sse2, FALSE); FAudio_INTERNAL_InitSIMDFunctions(has_sse2, FALSE);
FAudio_resolve_SetThreadDescription();
FAudio_PlatformAddRef(); FAudio_PlatformAddRef();
...@@ -305,6 +346,12 @@ void FAudio_PlatformQuit(void* platformDevice) ...@@ -305,6 +346,12 @@ void FAudio_PlatformQuit(void* platformDevice)
SetEvent(data->stopEvent); SetEvent(data->stopEvent);
WaitForSingleObject(data->audioThread, INFINITE); WaitForSingleObject(data->audioThread, INFINITE);
if (data->client) IAudioClient_Release(data->client); if (data->client) IAudioClient_Release(data->client);
if (kernelbase)
{
my_SetThreadDescription = NULL;
FreeLibrary(kernelbase);
kernelbase = NULL;
}
FAudio_PlatformRelease(); FAudio_PlatformRelease();
} }
...@@ -500,6 +547,7 @@ static DWORD WINAPI FaudioThreadWrapper(void *user) ...@@ -500,6 +547,7 @@ static DWORD WINAPI FaudioThreadWrapper(void *user)
struct FAudioThreadArgs *args = user; struct FAudioThreadArgs *args = user;
DWORD ret; DWORD ret;
FAudio_set_thread_name(args->name);
ret = args->func(args->data); ret = args->func(args->data);
FAudio_free(args); FAudio_free(args);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment