Commit 9281b542 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/tests: Add some tests for IPin::EndOfStream() on the DirectSound renderer.

parent c1bfa103
......@@ -877,6 +877,147 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
ok(hr == S_OK, "Got hr %#x.\n", hr);
}
static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
{
LONG_PTR param1, param2;
unsigned int ret = 0;
HRESULT hr;
LONG code;
while ((hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, timeout)) == S_OK)
{
if (code == EC_COMPLETE)
{
ok(param1 == S_OK, "Got param1 %#lx.\n", param1);
ok(!param2, "Got param2 %#lx.\n", param2);
ret++;
}
IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
timeout = 0;
}
ok(hr == E_ABORT, "Got hr %#x.\n", hr);
return ret;
}
static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
IMediaEvent *eventsrc;
OAFilterState state;
HRESULT hr;
BOOL ret;
IMediaControl_QueryInterface(control, &IID_IMediaEvent, (void **)&eventsrc);
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = send_frame(input);
todo_wine ok(hr == VFW_E_SAMPLE_REJECTED_EOS, "Got hr %#x.\n", hr);
hr = IMediaControl_Run(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
/* We do not receive an EC_COMPLETE notification until the last sample is
* done rendering. */
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = send_frame(input);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_Run(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
ret = check_ec_complete(eventsrc, 2000);
todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
/* Test sending EOS while flushing. */
hr = IMediaControl_Run(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = send_frame(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_BeginFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EndOfStream(pin);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IPin_EndFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
/* Test sending EOS and then flushing or stopping. */
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = send_frame(input);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_Run(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IPin_BeginFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EndFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = send_frame(input);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
IMediaEvent_Release(eventsrc);
}
static void test_connect_pin(void)
{
ALLOCATOR_PROPERTIES req_props = {1, 4 * 44100, 1, 0}, ret_props;
......@@ -971,6 +1112,7 @@ static void test_connect_pin(void)
test_filter_state(input, control);
test_flushing(pin, input, control);
test_eos(pin, input, control);
hr = IFilterGraph2_Disconnect(graph, pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......
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