Let winegstreamer's media source emit the same rate limits that Windows exposes for media sources generated with the standard source resolver.
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- dlls/mfplat/tests/mfplat.c | 8 -------- dlls/winegstreamer/media_source.c | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index cfc22f35927..60b86c75eb5 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -774,36 +774,28 @@ static void test_source_resolver(void)
hr = IMFRateSupport_GetFastestRate(rate_support, MFRATE_FORWARD, FALSE, &rate); ok(hr == S_OK, "Failed to query fastest rate, hr %#x.\n", hr); -todo_wine ok(rate == 1e6f, "Unexpected fastest rate %f.\n", rate); hr = IMFRateSupport_GetFastestRate(rate_support, MFRATE_FORWARD, TRUE, &rate); ok(hr == S_OK, "Failed to query fastest rate, hr %#x.\n", hr); -todo_wine ok(rate == 1e6f, "Unexpected fastest rate %f.\n", rate); hr = IMFRateSupport_GetFastestRate(rate_support, MFRATE_REVERSE, FALSE, &rate); ok(hr == S_OK, "Failed to query fastest rate, hr %#x.\n", hr); -todo_wine ok(rate == -1e6f, "Unexpected fastest rate %f.\n", rate); hr = IMFRateSupport_GetFastestRate(rate_support, MFRATE_REVERSE, TRUE, &rate); ok(hr == S_OK, "Failed to query fastest rate, hr %#x.\n", hr); -todo_wine ok(rate == -1e6f, "Unexpected fastest rate %f.\n", rate);
hr = IMFRateSupport_GetSlowestRate(rate_support, MFRATE_FORWARD, FALSE, &rate); ok(hr == S_OK, "Failed to query slowest rate, hr %#x.\n", hr); -todo_wine ok(rate == 0.0f, "Unexpected slowest rate %f.\n", rate); hr = IMFRateSupport_GetSlowestRate(rate_support, MFRATE_FORWARD, TRUE, &rate); ok(hr == S_OK, "Failed to query slowest rate, hr %#x.\n", hr); -todo_wine ok(rate == 0.0f, "Unexpected slowest rate %f.\n", rate); hr = IMFRateSupport_GetSlowestRate(rate_support, MFRATE_REVERSE, FALSE, &rate); ok(hr == S_OK, "Failed to query slowest rate, hr %#x.\n", hr); -todo_wine ok(rate == 0.0f, "Unexpected slowest rate %f.\n", rate); hr = IMFRateSupport_GetSlowestRate(rate_support, MFRATE_REVERSE, TRUE, &rate); ok(hr == S_OK, "Failed to query slowest rate, hr %#x.\n", hr); -todo_wine ok(rate == 0.0f, "Unexpected slowest rate %f.\n", rate);
check_service_interface(mediasource, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateControl, TRUE); diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index e153c8e9161..d013a60e150 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -933,7 +933,7 @@ static HRESULT WINAPI media_source_rate_support_GetSlowestRate(IMFRateSupport *i { TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
- *rate = direction == MFRATE_FORWARD ? 1.0f : -1.0f; + *rate = 0.0f;
return S_OK; } @@ -942,14 +942,14 @@ static HRESULT WINAPI media_source_rate_support_GetFastestRate(IMFRateSupport *i { TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
- *rate = direction == MFRATE_FORWARD ? 1.0f : -1.0f; + *rate = direction == MFRATE_FORWARD ? 1e6f : -1e6f;
return S_OK; }
static HRESULT WINAPI media_source_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate, float *nearest_support_rate) { - const float supported_rate = rate >= 0.0f ? 1.0f : -1.0f; + const float supported_rate = max(min(rate, 1e6f), -1e6f);
TRACE("%p, %d, %f, %p.\n", iface, thin, rate, nearest_support_rate);