mf/session: Fix computing fastest and slowest presentation rates.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Giovanni Mascellani 2021-06-08 13:30:53 +03:00 committed by Alexandre Julliard
parent 222d2d94e0
commit bcd2b99d95

View file

@ -18,6 +18,7 @@
#include <stdarg.h>
#include <math.h>
#include <float.h>
#define COBJMACROS
@ -3536,8 +3537,9 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
struct media_source *source;
struct media_sink *sink;
HRESULT hr = E_POINTER;
float rate;
*result = 0.0f;
rate = fastest ? FLT_MAX : 0.0f;
EnterCriticalSection(&session->cs);
@ -3545,7 +3547,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
{
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry)
{
if (FAILED(hr = session_presentation_object_get_rate((IUnknown *)source->source, direction, thin, fastest, result)))
if (FAILED(hr = session_presentation_object_get_rate((IUnknown *)source->source, direction, thin, fastest, &rate)))
break;
}
@ -3553,7 +3555,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
{
LIST_FOR_EACH_ENTRY(sink, &session->presentation.sinks, struct media_sink, entry)
{
if (FAILED(hr = session_presentation_object_get_rate((IUnknown *)sink->sink, direction, thin, fastest, result)))
if (FAILED(hr = session_presentation_object_get_rate((IUnknown *)sink->sink, direction, thin, fastest, &rate)))
break;
}
}
@ -3561,6 +3563,9 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
LeaveCriticalSection(&session->cs);
if (SUCCEEDED(hr))
*result = direction == MFRATE_FORWARD ? rate : -rate;
return hr;
}