From bcd2b99d959f4a630cac9d3167a6785f2e039cc0 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Tue, 8 Jun 2021 13:30:53 +0300 Subject: [PATCH] mf/session: Fix computing fastest and slowest presentation rates. Signed-off-by: Giovanni Mascellani Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/session.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index 41caf02d059..9f233295773 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -18,6 +18,7 @@ #include #include +#include #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; }