From 5aa4b702c009f1ff7fe09f0276dec87cd520e556 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 25 Sep 2018 16:00:30 +0200 Subject: [PATCH] Fixed dst_format --- include/freerdp/server/audin.h | 2 +- server/Sample/sf_audin.c | 20 +++++--------------- server/shadow/shadow_audin.c | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/freerdp/server/audin.h b/include/freerdp/server/audin.h index 1d69bf524..7e13d89db 100644 --- a/include/freerdp/server/audin.h +++ b/include/freerdp/server/audin.h @@ -50,7 +50,7 @@ struct _audin_server_context size_t num_server_formats; /* Server destination PCM audio format. Set by server. */ - AUDIO_FORMAT dst_format; + AUDIO_FORMAT* dst_format; /* Server preferred frames per packet. */ int frames_per_packet; diff --git a/server/Sample/sf_audin.c b/server/Sample/sf_audin.c index d8f34b58b..022b5bc62 100644 --- a/server/Sample/sf_audin.c +++ b/server/Sample/sf_audin.c @@ -32,12 +32,6 @@ #include #define TAG SERVER_TAG("sample") -static AUDIO_FORMAT test_audio_formats[] = -{ - { WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL }, - { WAVE_FORMAT_ALAW, 2, 22050, 44100, 2, 8, 0, NULL } -}; - /** * Function description * @@ -67,7 +61,8 @@ static UINT sf_peer_audin_open_result(audin_server_context* context, UINT32 resu * * @return 0 on success, otherwise a Win32 error code */ -static UINT sf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes) +static UINT sf_peer_audin_receive_samples(audin_server_context* context, const void* buf, + int nframes) { WLog_DBG(TAG, "AUDIN receive %d frames.", nframes); return CHANNEL_RC_OK; @@ -78,15 +73,10 @@ void sf_peer_audin_init(testPeerContext* context) context->audin = audin_server_context_new(context->vcm); context->audin->rdpcontext = &context->_p; context->audin->data = context; + context->audin->num_server_formats = server_audin_get_formats(&context->audin->server_formats); - context->audin->server_formats = test_audio_formats; - context->audin->num_server_formats = - sizeof(test_audio_formats) / sizeof(test_audio_formats[0]); - - context->audin->dst_format.wFormatTag = 1; - context->audin->dst_format.nChannels = 2; - context->audin->dst_format.nSamplesPerSec = 44100; - context->audin->dst_format.wBitsPerSample = 16; + if (context->audin->num_server_formats > 0) + context->audin->dst_format = &context->audin->server_formats[0]; context->audin->Opening = sf_peer_audin_opening; context->audin->OpenResult = sf_peer_audin_open_result; diff --git a/server/shadow/shadow_audin.c b/server/shadow/shadow_audin.c index 2075802df..2d494b5c6 100644 --- a/server/shadow/shadow_audin.c +++ b/server/shadow/shadow_audin.c @@ -126,7 +126,7 @@ BOOL shadow_client_audin_init(rdpShadowClient* client) if (audin->num_server_formats < 1) goto fail; - audin->dst_format = audin->server_formats[0]; + audin->dst_format = &audin->server_formats[0]; audin->Opening = AudinServerOpening; audin->OpenResult = AudinServerOpenResult; audin->ReceiveSamples = AudinServerReceiveSamples;