Commit fd79a285 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/filesource: Add a test for cross-thread asynchronous read requests.

parent 0523f759
......@@ -808,12 +808,28 @@ static void test_sync_read_aligned(IAsyncReader *reader, IMemAllocator *allocato
IMediaSample_Release(sample);
}
struct request_thread_params
{
IAsyncReader *reader;
IMediaSample *sample;
};
static DWORD CALLBACK request_thread(void *arg)
{
struct request_thread_params *params = arg;
HRESULT hr = IAsyncReader_Request(params->reader, params->sample, 123);
ok(hr == S_OK, "Got hr %#x.\n", hr);
return 0;
}
static void test_request(IAsyncReader *reader, IMemAllocator *allocator)
{
IMediaSample *sample, *sample2, *ret_sample;
struct request_thread_params params;
REFERENCE_TIME start_time, end_time;
BYTE *data, *data2;
DWORD_PTR cookie;
HANDLE thread;
HRESULT hr;
LONG len;
int i;
......@@ -897,6 +913,17 @@ static void test_request(IAsyncReader *reader, IMemAllocator *allocator)
for (i = 0; i < 88; i++)
ok(data2[i] == (512 + i) % 111, "Got wrong byte %02x at %u.\n", data2[i], i);
params.reader = reader;
params.sample = sample;
thread = CreateThread(NULL, 0, request_thread, &params, 0, NULL);
ok(!WaitForSingleObject(thread, 1000), "Wait timed out.\n");
CloseHandle(thread);
hr = IAsyncReader_WaitForNext(reader, 1000, &ret_sample, &cookie);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(ret_sample == sample, "Samples didn't match.\n");
ok(cookie == 123, "Got cookie %lu.\n", cookie);
IMediaSample_Release(sample);
IMediaSample_Release(sample2);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment