wfreerdp-server: sound latency tweaks

This commit is contained in:
Corey C 2013-02-15 20:39:31 -05:00
parent 347484c149
commit 231eda37cd
1 changed files with 12 additions and 6 deletions

View File

@ -7,8 +7,15 @@
#include <Functiondiscoverykeys_devpkey.h>
#include <Audioclient.h>
#define REFTIMES_PER_SEC 10000000
#define REFTIMES_PER_MILLISEC 10000
//#define REFTIMES_PER_SEC 10000000
//#define REFTIMES_PER_MILLISEC 10000
//#define REFTIMES_PER_SEC 100000
//#define REFTIMES_PER_MILLISEC 100
#define REFTIMES_PER_SEC 50000
#define REFTIMES_PER_MILLISEC 50
DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C,
0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E);
@ -119,8 +126,6 @@ int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR * deviceStr)
exit(1);
}
//do this a more reliable way
if (wcscmp(pattern, nameVar.pwszVal) < 0)
{
@ -262,7 +267,7 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
Sleep(hnsActualDuration/REFTIMES_PER_MILLISEC/2);
hr = pCaptureClient->lpVtbl->GetNextPacketSize(pCaptureClient, &packetLength);
if (FAILED(hr))
{
@ -281,7 +286,8 @@ DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam)
//write data here
//fwrite(pData, 1, packetLength * 4, pFile);
context->rdpsnd->SendSamples(context->rdpsnd, pData, packetLength);
if (!(flags & AUDCLNT_BUFFERFLAGS_SILENT))
context->rdpsnd->SendSamples(context->rdpsnd, pData, packetLength);
hr = pCaptureClient->lpVtbl->ReleaseBuffer(pCaptureClient, numFramesAvailable);
if (FAILED(hr))