[channels,rdpsnd] Callback on server format

When the server sends the format list to the client call a device
callback that provides the details to the audio backend.
This commit is contained in:
akallabeth 2022-12-13 15:05:07 +01:00 committed by Martin Fleisz
parent a1febe11f0
commit 8aa880c0ba
2 changed files with 20 additions and 9 deletions

View File

@ -180,6 +180,7 @@ static void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
if (!audio_format_compatible(rdpsnd->fixed_format, serverFormat))
continue;
WINPR_ASSERT(rdpsnd->device->FormatSupported);
if (freerdp_dsp_supports_format(serverFormat, FALSE) ||
rdpsnd->device->FormatSupported(rdpsnd->device, serverFormat))
{
@ -282,6 +283,8 @@ static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream*
if (!Stream_CheckAndLogRequiredLength(TAG, s, 14ull * wNumberOfFormats))
return ERROR_BAD_LENGTH;
if (rdpsnd->NumberOfServerFormats > 0)
{
rdpsnd->ServerFormats = audio_formats_new(wNumberOfFormats);
if (!rdpsnd->ServerFormats)
@ -294,6 +297,11 @@ static UINT rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream*
if (!audio_format_read(s, format))
goto out_fail;
}
}
WINPR_ASSERT(rdpsnd->device);
ret = IFCALLRESULT(CHANNEL_RC_OK, rdpsnd->device->ServerFormatAnnounce, rdpsnd->device,
rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
rdpsnd_select_supported_audio_formats(rdpsnd);
WLog_Print(rdpsnd->log, WLOG_DEBUG, "%s Server Audio Formats",

View File

@ -44,6 +44,8 @@ extern "C"
typedef void (*pcFree)(rdpsndDevicePlugin* device);
typedef BOOL (*pcDefaultFormat)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* desired,
AUDIO_FORMAT* defaultFormat);
typedef UINT (*pcServerFormatAnnounce)(rdpsndDevicePlugin* device, const AUDIO_FORMAT* formats,
size_t count);
struct rdpsnd_device_plugin
{
@ -58,6 +60,7 @@ extern "C"
pcClose Close;
pcFree Free;
pcDefaultFormat DefaultFormat;
pcServerFormatAnnounce ServerFormatAnnounce;
};
#define RDPSND_DEVICE_EXPORT_FUNC_NAME "freerdp_rdpsnd_client_subsystem_entry"