Commit bcd2b99d authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

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

parent 222d2d94
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <math.h> #include <math.h>
#include <float.h>
#define COBJMACROS #define COBJMACROS
...@@ -3536,8 +3537,9 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA ...@@ -3536,8 +3537,9 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
struct media_source *source; struct media_source *source;
struct media_sink *sink; struct media_sink *sink;
HRESULT hr = E_POINTER; HRESULT hr = E_POINTER;
float rate;
*result = 0.0f; rate = fastest ? FLT_MAX : 0.0f;
EnterCriticalSection(&session->cs); EnterCriticalSection(&session->cs);
...@@ -3545,7 +3547,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA ...@@ -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) 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; break;
} }
...@@ -3553,7 +3555,7 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA ...@@ -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) 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; break;
} }
} }
...@@ -3561,6 +3563,9 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA ...@@ -3561,6 +3563,9 @@ static HRESULT session_get_presentation_rate(struct media_session *session, MFRA
LeaveCriticalSection(&session->cs); LeaveCriticalSection(&session->cs);
if (SUCCEEDED(hr))
*result = direction == MFRATE_FORWARD ? rate : -rate;
return hr; return 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