Commit ae999738 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/evr: Fix rate limits methods.

parent 1d2e6e6a
......@@ -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,
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment