mmdevapi/tests: Test in-proc marshal of IAudioClient.
This commit is contained in:
parent
75bde26bea
commit
0f4bc3b945
|
@ -39,6 +39,7 @@
|
|||
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
|
||||
|
||||
static IMMDevice *dev = NULL;
|
||||
static const LARGE_INTEGER ullZero;
|
||||
|
||||
static void test_uninitialized(IAudioClient *ac)
|
||||
{
|
||||
|
@ -1008,6 +1009,69 @@ static void test_volume_dependence(void)
|
|||
IAudioClient_Release(ac);
|
||||
}
|
||||
|
||||
static void test_marshal(void)
|
||||
{
|
||||
IStream *pStream;
|
||||
IAudioClient *ac, *acDest;
|
||||
IAudioCaptureClient *cc, *ccDest;
|
||||
WAVEFORMATEX *pwfx;
|
||||
HRESULT hr;
|
||||
|
||||
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
|
||||
NULL, (void**)&ac);
|
||||
ok(hr == S_OK, "Activation failed with %08x\n", hr);
|
||||
if(hr != S_OK)
|
||||
return;
|
||||
|
||||
hr = IAudioClient_GetMixFormat(ac, &pwfx);
|
||||
ok(hr == S_OK, "GetMixFormat failed: %08x\n", hr);
|
||||
|
||||
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000,
|
||||
0, pwfx, NULL);
|
||||
ok(hr == S_OK, "Initialize failed: %08x\n", hr);
|
||||
|
||||
CoTaskMemFree(pwfx);
|
||||
|
||||
hr = IAudioClient_GetService(ac, &IID_IAudioCaptureClient, (void**)&cc);
|
||||
ok(hr == S_OK, "GetService failed: %08x\n", hr);
|
||||
if(hr != S_OK) {
|
||||
IAudioClient_Release(ac);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
|
||||
ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x\n", hr);
|
||||
|
||||
/* marshal IAudioClient */
|
||||
|
||||
hr = CoMarshalInterface(pStream, &IID_IAudioClient, (IUnknown*)ac, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
|
||||
ok(hr == S_OK, "CoMarshalInterface IAudioClient failed 0x%08x\n", hr);
|
||||
|
||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
||||
hr = CoUnmarshalInterface(pStream, &IID_IAudioClient, (void **)&acDest);
|
||||
ok(hr == S_OK, "CoUnmarshalInterface IAudioClient failed 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
IAudioClient_Release(acDest);
|
||||
|
||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
||||
/* marshal IAudioCaptureClient */
|
||||
|
||||
hr = CoMarshalInterface(pStream, &IID_IAudioCaptureClient, (IUnknown*)cc, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
|
||||
ok(hr == S_OK, "CoMarshalInterface IAudioCaptureClient failed 0x%08x\n", hr);
|
||||
|
||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
||||
hr = CoUnmarshalInterface(pStream, &IID_IAudioCaptureClient, (void **)&ccDest);
|
||||
ok(hr == S_OK, "CoUnmarshalInterface IAudioCaptureClient failed 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
IAudioCaptureClient_Release(ccDest);
|
||||
|
||||
IStream_Release(pStream);
|
||||
|
||||
IAudioClient_Release(ac);
|
||||
IAudioCaptureClient_Release(cc);
|
||||
|
||||
}
|
||||
|
||||
START_TEST(capture)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -1037,6 +1101,7 @@ START_TEST(capture)
|
|||
test_channelvolume();
|
||||
test_simplevolume();
|
||||
test_volume_dependence();
|
||||
test_marshal();
|
||||
|
||||
IMMDevice_Release(dev);
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ static IMMDeviceEnumerator *mme = NULL;
|
|||
static IMMDevice *dev = NULL;
|
||||
static HRESULT hexcl = S_OK; /* or AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED */
|
||||
|
||||
static const LARGE_INTEGER ullZero;
|
||||
|
||||
static inline const char *dbgstr_guid( const GUID *id )
|
||||
{
|
||||
static char ret[256];
|
||||
|
@ -2159,6 +2161,71 @@ static void test_worst_case(void)
|
|||
IAudioRenderClient_Release(arc);
|
||||
}
|
||||
|
||||
static void test_marshal(void)
|
||||
{
|
||||
IStream *pStream;
|
||||
IAudioClient *ac, *acDest;
|
||||
IAudioRenderClient *rc, *rcDest;
|
||||
WAVEFORMATEX *pwfx;
|
||||
HRESULT hr;
|
||||
|
||||
/* IAudioRenderClient */
|
||||
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
|
||||
NULL, (void**)&ac);
|
||||
ok(hr == S_OK, "Activation failed with %08x\n", hr);
|
||||
if(hr != S_OK)
|
||||
return;
|
||||
|
||||
hr = IAudioClient_GetMixFormat(ac, &pwfx);
|
||||
ok(hr == S_OK, "GetMixFormat failed: %08x\n", hr);
|
||||
|
||||
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000,
|
||||
0, pwfx, NULL);
|
||||
ok(hr == S_OK, "Initialize failed: %08x\n", hr);
|
||||
|
||||
CoTaskMemFree(pwfx);
|
||||
|
||||
hr = IAudioClient_GetService(ac, &IID_IAudioRenderClient, (void**)&rc);
|
||||
ok(hr == S_OK, "GetService failed: %08x\n", hr);
|
||||
if(hr != S_OK) {
|
||||
IAudioClient_Release(ac);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
|
||||
ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x\n", hr);
|
||||
|
||||
/* marshal IAudioClient */
|
||||
|
||||
hr = CoMarshalInterface(pStream, &IID_IAudioClient, (IUnknown*)ac, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
|
||||
ok(hr == S_OK, "CoMarshalInterface IAudioClient failed 0x%08x\n", hr);
|
||||
|
||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
||||
hr = CoUnmarshalInterface(pStream, &IID_IAudioClient, (void **)&acDest);
|
||||
ok(hr == S_OK, "CoUnmarshalInterface IAudioClient failed 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
IAudioClient_Release(acDest);
|
||||
|
||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
||||
/* marshal IAudioRenderClient */
|
||||
|
||||
hr = CoMarshalInterface(pStream, &IID_IAudioRenderClient, (IUnknown*)rc, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
|
||||
ok(hr == S_OK, "CoMarshalInterface IAudioRenderClient failed 0x%08x\n", hr);
|
||||
|
||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
||||
hr = CoUnmarshalInterface(pStream, &IID_IAudioRenderClient, (void **)&rcDest);
|
||||
ok(hr == S_OK, "CoUnmarshalInterface IAudioRenderClient failed 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
IAudioRenderClient_Release(rcDest);
|
||||
|
||||
|
||||
IStream_Release(pStream);
|
||||
|
||||
IAudioClient_Release(ac);
|
||||
IAudioRenderClient_Release(rc);
|
||||
|
||||
}
|
||||
|
||||
START_TEST(render)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -2186,6 +2253,7 @@ START_TEST(render)
|
|||
test_formats(AUDCLNT_SHAREMODE_EXCLUSIVE);
|
||||
test_formats(AUDCLNT_SHAREMODE_SHARED);
|
||||
test_references();
|
||||
test_marshal();
|
||||
trace("Output to a MS-DOS console is particularly slow and disturbs timing.\n");
|
||||
trace("Please redirect output to a file.\n");
|
||||
test_event();
|
||||
|
|
Loading…
Reference in New Issue