wfreerdp-server: make rdpsnd backend selectable at build time

This commit is contained in:
Corey C 2013-02-18 14:40:37 -05:00
parent be7a84ec72
commit 6176085ea1
4 changed files with 44 additions and 20 deletions

View File

@ -40,6 +40,7 @@
#cmakedefine WITH_NATIVE_SSPI
#cmakedefine WITH_JPEG
#cmakedefine WITH_WIN8
#cmakedefine WITH_RDPSND_DSOUND
/* Plugins */
#cmakedefine STATIC_CHANNELS

View File

@ -33,16 +33,30 @@ set(${MODULE_PREFIX}_SRCS
wf_mirage.h
wf_peer.c
wf_peer.h
wf_rdpsnd.c
wf_rdpsnd.h
wf_directsound.c
wf_directsound.h
wf_wasapi.c
wf_wasapi.h
wf_settings.c
wf_settings.h
wf_info.c
wf_info.h)
if(CHANNEL_RDPSND AND NOT WITH_RDPSND_DSOUND)
set(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_SRCS}
wf_rdpsnd.c
wf_rdpsnd.h
wf_wasapi.c
wf_wasapi.h
)
endif()
if(CHANNEL_RDPSND AND WITH_RDPSND_DSOUND)
set(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_SRCS}
wf_rdpsnd.c
wf_rdpsnd.h
wf_directsound.c
wf_directsound.h
)
endif()
if(WITH_SERVER_INTERFACE)
add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})

View File

@ -27,6 +27,7 @@
#include <winpr/windows.h>
/*
#define INITGUID
#include <initguid.h>
#include <objbase.h>
@ -37,18 +38,21 @@
#include <freerdp/server/rdpsnd.h>
*/
#include "wf_rdpsnd.h"
#include "wf_directsound.h"
#include "wf_wasapi.h"
#include "wf_info.h"
#ifdef WITH_RDPSND_DSOUND
#include "wf_directsound.h"
#else
//#define BYTESPERSEC 176400
#include "wf_wasapi.h"
#endif
//FIXME support multiple clients
//wfPeerContext* latestPeer;
static const rdpsndFormat test_audio_formats[] =
{
@ -66,9 +70,16 @@ static const rdpsndFormat test_audio_formats[] =
static void wf_peer_rdpsnd_activated(rdpsnd_server_context* context)
{
#ifdef WITH_RDPSND_DSOUND
wf_directsound_activate(context);
#else
//wf_directsound_activate(context);
wf_wasapi_activate(context);
#endif
}
int wf_rdpsnd_lock()
@ -138,8 +149,6 @@ BOOL wf_peer_rdpsnd_init(wfPeerContext* context)
context->rdpsnd->Initialize(context->rdpsnd);
wf_directsound_set_latest_peer(context);
wfi->snd_stop = FALSE;
return TRUE;
}

View File

@ -10,11 +10,11 @@
//#define REFTIMES_PER_SEC 10000000
//#define REFTIMES_PER_MILLISEC 10000
//#define REFTIMES_PER_SEC 100000
//#define REFTIMES_PER_MILLISEC 100
#define REFTIMES_PER_SEC 100000
#define REFTIMES_PER_MILLISEC 100
#define REFTIMES_PER_SEC 50000
#define REFTIMES_PER_MILLISEC 50
//#define REFTIMES_PER_SEC 50000
//#define REFTIMES_PER_MILLISEC 50
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C,
@ -278,8 +278,8 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
exit(1);
}
//write data here
//fwrite(pData, 1, packetLength * 4, pFile);
//Here we are writing the audio data
//not sure if this flag is ever set by the system; msdn is not clear about it
if (!(flags & AUDCLNT_BUFFERFLAGS_SILENT))
context->rdpsnd->SendSamples(context->rdpsnd, pData, packetLength);