On 5/28/21 10:50 AM, Giovanni Mascellani wrote:
+#define expect_event(s, m) expect_event_(__LINE__, s, m) +static void expect_event_(int line, IMFStreamSink *stream, MediaEventType met) +{
- HRESULT hr, hr2;
- IMFMediaEvent *event;
- MediaEventType got_met;
- hr = IMFStreamSink_GetEvent(stream, 0, &event);
- ok_(__FILE__, line)(hr == S_OK, "Cannot get event, hr %#x.\n", hr);
- ok_(__FILE__, line)(event != NULL, "Got NULL event.\n");
- hr = IMFMediaEvent_GetStatus(event, &hr2);
- ok_(__FILE__, line)(hr == S_OK, "Cannot get status, hr %#x.\n", hr);
- ok_(__FILE__, line)(hr2 == S_OK, "Unexpected status, hr %#x.\n", hr2);
- hr = IMFMediaEvent_GetType(event, &got_met);
- ok_(__FILE__, line)(hr == S_OK, "Cannot get type, hr %#x.\n", hr);
- ok_(__FILE__, line)(got_met == met, "Unexpected event type %d instead of %d.\n", got_met, met);
- IMFMediaEvent_Release(event);
+}
I don't think we want that, it's blocking, so can potentially hang the test program, and you won't know where that happened.
- for (i = 0; i < 4; i++)
expect_event(stream, MEStreamSinkRequestSample);
- expect_event(stream, MEStreamSinkStarted);
Same here, the test only cares for state changes, and checking for everything exposes this improvised on-start prerolling.