From: Brendan McGrath <bmcgrath(a)codeweavers.com> --- dlls/mf/tests/mf.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 9a69b127a23..cdcde65841d 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2365,6 +2365,8 @@ struct test_seek_clock_sink LONG refcount; }; +DEFINE_EXPECT(test_seek_clock_sink_OnClockSetRate); + static struct test_seek_clock_sink *impl_from_IMFClockStateSink(IMFClockStateSink *iface) { return CONTAINING_RECORD(iface, struct test_seek_clock_sink, IMFClockStateSink_iface); @@ -2427,6 +2429,7 @@ static HRESULT WINAPI test_seek_clock_sink_OnClockRestart(IMFClockStateSink *ifa static HRESULT WINAPI test_seek_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME system_time, float rate) { + CHECK_EXPECT(test_seek_clock_sink_OnClockSetRate); add_object_state(&actual_object_state_record, SINK_ON_CLOCK_SETRATE); return S_OK; } @@ -8615,11 +8618,12 @@ static void test_media_session_scrubbing(void) CHECK_CALLED(test_transform_ProcessMessage_BEGIN_STREAMING); /* Test that when rate is zero (i.e. we're scrubbing), no preroll occurs */ + SET_EXPECT(test_media_sink_GetPresentationClock); + SET_EXPECT(test_media_sink_SetPresentationClock); + SET_EXPECT(test_seek_clock_sink_OnClockSetRate); hr = IMFRateControl_SetRate(rate_control, FALSE, 0.0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - SET_EXPECT(test_media_sink_GetPresentationClock); - SET_EXPECT(test_media_sink_SetPresentationClock); SET_EXPECT(test_transform_ProcessMessage_START_OF_STREAM); SET_EXPECT(test_media_sink_GetStreamSinkCount); propvar.vt = VT_I8; /* hVal will be zero */ @@ -8637,6 +8641,7 @@ static void test_media_session_scrubbing(void) CHECK_CALLED(test_transform_ProcessMessage_START_OF_STREAM); todo_wine CHECK_CALLED(test_media_sink_GetStreamSinkCount); + CHECK_CALLED(test_seek_clock_sink_OnClockSetRate); hr = IMFStreamSink_QueueEvent(media_sink->stream, MEStreamSinkScrubSampleComplete, &GUID_NULL, S_OK, &propvar); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -8670,10 +8675,11 @@ static void test_media_session_scrubbing(void) CHECK_CALLED(test_stream_sink_Flush); /* Test that during a standard start (i.e. rate == 1.0), preroll is called on the sink */ + SET_EXPECT(test_seek_clock_sink_OnClockSetRate); + SET_EXPECT(test_media_sink_GetPresentationClock); hr = IMFRateControl_SetRate(rate_control, FALSE, 1.0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - SET_EXPECT(test_media_sink_GetPresentationClock); SET_EXPECT(test_transform_ProcessMessage_START_OF_STREAM); SET_EXPECT(test_media_sink_preroll_NotifyPreroll); propvar.vt = VT_I8; /* hVal will be zero */ @@ -8689,6 +8695,8 @@ static void test_media_session_scrubbing(void) todo_wine CHECK_CALLED(test_transform_ProcessMessage_START_OF_STREAM); CHECK_CALLED(test_media_sink_preroll_NotifyPreroll); + todo_wine + CHECK_CALLED(test_seek_clock_sink_OnClockSetRate); SET_EXPECT(test_media_sink_GetStreamSinkCount); hr = IMFStreamSink_QueueEvent(media_sink->stream, MEStreamSinkPrerolled, &GUID_NULL, S_OK, &propvar); @@ -8705,6 +8713,37 @@ static void test_media_session_scrubbing(void) todo_wine CHECK_CALLED(test_media_sink_GetStreamSinkCount); + /* Test that a rate change whilst in the PLAY state is a no-op */ + hr = IMFRateControl_SetRate(rate_control, FALSE, 0.0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + /* But registers with the sink in the PAUSE state */ + hr = IMFMediaSession_Pause(session); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFStreamSink_QueueEvent(media_sink->stream, MEStreamSinkPaused, &GUID_NULL, S_OK, &propvar); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + PropVariantClear(&propvar); + + hr = wait_media_event_until_blocking(session, callback, MESessionPaused, 1000, &propvar); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + PropVariantClear(&propvar); + + SET_EXPECT(test_media_sink_GetPresentationClock); + SET_EXPECT(test_seek_clock_sink_OnClockSetRate); + hr = IMFRateControl_SetRate(rate_control, FALSE, 0.0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = wait_media_event_until_blocking(session, callback, MESessionRateChanged, 1000, &propvar); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + PropVariantClear(&propvar); + todo_wine + CHECK_CALLED(test_media_sink_GetPresentationClock); + todo_wine + CHECK_CALLED(test_seek_clock_sink_OnClockSetRate); + /* Release all the used resources */ IMFPresentationClock_RemoveClockStateSink(presentation_clock, &test_seek_clock_sink->IMFClockStateSink_iface); IMFPresentationClock_Release(presentation_clock); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9646