Fixed server audin callback, provide more information.

This commit is contained in:
Armin Novak
2018-09-25 16:25:35 +02:00
parent 5aa4b702c0
commit 16531e1437
4 changed files with 16 additions and 9 deletions

View File

@@ -335,11 +335,15 @@ static UINT audin_server_recv_data(audin_server* audin, wStream* s,
if (freerdp_dsp_decode(audin->dsp_context, format, Stream_Pointer(s), length, out))
{
AUDIO_FORMAT dformat = *format;
dformat.wFormatTag = WAVE_FORMAT_PCM;
dformat.wBitsPerSample = 16;
Stream_SealLength(out);
Stream_SetPosition(out, 0);
sbytes_per_sample = format->wBitsPerSample / 8;
sbytes_per_frame = format->nChannels * sbytes_per_sample;
frames = Stream_Length(out) / sbytes_per_frame;
IFCALLRET(audin->context.ReceiveSamples, success, &audin->context, Stream_Buffer(out), frames);
IFCALLRET(audin->context.ReceiveSamples, success, &audin->context, &dformat, out, frames);
if (success)
WLog_ERR(TAG, "context.ReceiveSamples failed with error %"PRIu32"", success);

View File

@@ -35,8 +35,9 @@ typedef BOOL (*psAudinServerClose)(audin_server_context* context);
typedef UINT(*psAudinServerOpening)(audin_server_context* context);
typedef UINT(*psAudinServerOpenResult)(audin_server_context* context, UINT32 result);
typedef UINT(*psAudinServerReceiveSamples)(audin_server_context* context, const void* buf,
int nframes);
typedef UINT(*psAudinServerReceiveSamples)(audin_server_context* context,
const AUDIO_FORMAT* format, wStream* buf,
size_t nframes);
struct _audin_server_context
{

View File

@@ -86,9 +86,9 @@ typedef BOOL (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem,
typedef BOOL (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem,
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y);
typedef void (*pfnShadowChannelAudinServerReceiveSamples)(
rdpShadowSubsystem* subsystem, rdpShadowClient* client, const void* buf,
int nframes);
typedef BOOL (*pfnShadowChannelAudinServerReceiveSamples)(
rdpShadowSubsystem* subsystem, rdpShadowClient* client,
const AUDIO_FORMAT* format, wStream* buf, size_t nframes);
struct rdp_shadow_client
{

View File

@@ -78,7 +78,8 @@ static UINT AudinServerOpenResult(audin_server_context* context, UINT32 result)
*
* @return 0 on success, otherwise a Win32 error code
*/
static UINT AudinServerReceiveSamples(audin_server_context* context, const void* buf, int nframes)
static UINT AudinServerReceiveSamples(audin_server_context* context, const AUDIO_FORMAT* format,
wStream* buf, size_t nframes)
{
rdpShadowClient* client = (rdpShadowClient*)context->data;
rdpShadowSubsystem* subsystem = client->server->subsystem;
@@ -86,8 +87,9 @@ static UINT AudinServerReceiveSamples(audin_server_context* context, const void*
if (!client->mayInteract)
return CHANNEL_RC_OK;
if (subsystem->AudinServerReceiveSamples)
subsystem->AudinServerReceiveSamples(subsystem, client, buf, nframes);
if (!IFCALLRESULT(TRUE, subsystem->AudinServerReceiveSamples, subsystem, client, format, buf,
nframes))
return ERROR_INTERNAL_ERROR;
return CHANNEL_RC_OK;
}