quartz/filesource: Add a test for cross-thread asynchronous read requests.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0523f75933
commit
fd79a28593
|
@ -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, ¶ms, 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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue