Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 33 ++++++++++++++++++++++++++++----- dlls/mf/tests/mf.c | 21 +++++++++++++++++---- 2 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 1d7c792fb1a..b035b8b601b 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#include <float.h> + #define COBJMACROS
#include "mf_private.h" @@ -2730,25 +2732,46 @@ static HRESULT WINAPI video_renderer_rate_support_GetSlowestRate(IMFRateSupport BOOL thin, float *rate) { struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + HRESULT hr = S_OK;
TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
+ EnterCriticalSection(&renderer->cs); if (renderer->flags & EVR_SHUT_DOWN) - return MF_E_SHUTDOWN; - - *rate = 0.0f; + hr = MF_E_SHUTDOWN; + else if (!rate) + hr = E_POINTER; + else + { + *rate = 0.0f; + } + LeaveCriticalSection(&renderer->cs);
- return S_OK; + return hr; }
static HRESULT WINAPI video_renderer_rate_support_GetFastestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, BOOL thin, float *rate) { struct video_renderer *renderer = impl_from_IMFRateSupport(iface); + HRESULT hr = S_OK;
TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
- return renderer->flags & EVR_SHUT_DOWN ? MF_E_SHUTDOWN : MF_E_INVALIDREQUEST; + EnterCriticalSection(&renderer->cs); + if (renderer->flags & EVR_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + else if (!rate) + hr = E_POINTER; + else if (video_renderer_is_main_stream_configured(renderer)) + { + *rate = direction == MFRATE_FORWARD ? FLT_MAX : -FLT_MAX; + } + else + hr = MF_E_INVALIDREQUEST; + LeaveCriticalSection(&renderer->cs); + + return hr; }
static HRESULT WINAPI video_renderer_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate, diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 58c7cbbadd4..b3f50665e79 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -4612,6 +4612,9 @@ todo_wine { hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, &rate); ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
+ hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(supported_rates); ++i) { rate = supported_rates[i] + 1.0f; @@ -4661,16 +4664,20 @@ todo_wine {
rate = 0.0f; hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, TRUE, &rate); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(rate == FLT_MAX, "Unexpected rate %f.\n", rate); -} + rate = 0.0f; hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, &rate); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(rate == -FLT_MAX, "Unexpected rate %f.\n", rate); -} + + hr = IMFRateSupport_GetFastestRate(rs, MFRATE_REVERSE, TRUE, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_REVERSE, TRUE, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(supported_rates); ++i) { rate = supported_rates[i] + 1.0f; @@ -4709,6 +4716,12 @@ todo_wine { hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, FALSE, &rate); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+ hr = IMFRateSupport_GetSlowestRate(rs, MFRATE_FORWARD, FALSE, NULL); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFRateSupport_GetFastestRate(rs, MFRATE_FORWARD, FALSE, NULL); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + hr = IMFRateSupport_IsRateSupported(rs, TRUE, 1.0f, &rate); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);