[PATCH 7/7] mf: Return earlier for clock state change calls when time source is not set.
Nikolay Sivov
nsivov at codeweavers.com
Fri Oct 4 06:42:49 CDT 2019
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mf/session.c | 3 +++
dlls/mf/tests/mf.c | 21 +++++++++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index bf1e48aaf7..a3c0ee717f 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -1923,6 +1923,9 @@ static HRESULT clock_change_state(struct presentation_clock *clock, enum clock_c
MFTIME system_time;
HRESULT hr;
+ if (!clock->time_source)
+ return MF_E_CLOCK_NO_TIME_SOURCE;
+
if (command != CLOCK_CMD_SET_RATE && clock->state == states[command] && clock->state != MFCLOCK_STATE_RUNNING)
return MF_E_CLOCK_STATE_ALREADY_SET;
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index b221398a71..e118c36ec7 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -1501,6 +1501,9 @@ static void test_presentation_clock(void)
hr = MFCreatePresentationClock(&clock);
ok(hr == S_OK, "Failed to create presentation clock, hr %#x.\n", hr);
+ hr = IMFPresentationClock_QueryInterface(clock, &IID_IMFRateControl, (void **)&rate_control);
+ ok(hr == S_OK, "Failed to get rate control interface, hr %#x.\n", hr);
+
hr = IMFPresentationClock_GetTimeSource(clock, &time_source);
ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
@@ -1521,7 +1524,7 @@ static void test_presentation_clock(void)
value = 1;
hr = IMFPresentationClock_GetContinuityKey(clock, &value);
- ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(hr == S_OK, "Failed to get continuity key, hr %#x.\n", hr);
ok(value == 0, "Unexpected value %u.\n", value);
hr = IMFPresentationClock_GetProperties(clock, &props);
@@ -1559,6 +1562,19 @@ static void test_presentation_clock(void)
hr = IMFPresentationClock_RemoveClockStateSink(clock, &test_sink);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ /* State change commands, time source is not set yet. */
+ hr = IMFPresentationClock_Start(clock, 0);
+ ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFPresentationClock_Pause(clock);
+ ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFPresentationClock_Stop(clock);
+ ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+
+ hr = IMFRateControl_SetRate(rate_control, FALSE, 0.0f);
+ ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+
/* Set default time source. */
hr = MFCreateSystemTimeSource(&time_source);
ok(hr == S_OK, "Failed to create time source, hr %#x.\n", hr);
@@ -1631,9 +1647,6 @@ static void test_presentation_clock(void)
IMFPresentationTimeSource_Release(time_source);
- hr = IMFPresentationClock_QueryInterface(clock, &IID_IMFRateControl, (void **)&rate_control);
- ok(hr == S_OK, "Failed to get rate control interface, hr %#x.\n", hr);
-
hr = IMFRateControl_GetRate(rate_control, NULL, &rate);
ok(hr == S_OK, "Failed to get clock rate, hr %#x.\n", hr);
--
2.23.0
More information about the wine-devel
mailing list