Commit 74b64eab authored by Santino Mazza's avatar Santino Mazza Committed by Alexandre Julliard

mf/session: Handle errors when subscribing to source's events.

parent 2580799e
......@@ -866,13 +866,13 @@ static void session_command_complete_with_event(struct media_session *session, M
session_command_complete(session);
}
static void session_subscribe_sources(struct media_session *session)
static HRESULT session_subscribe_sources(struct media_session *session)
{
struct media_source *source;
HRESULT hr;
HRESULT hr = S_OK;
if (session->presentation.flags & SESSION_FLAG_SOURCES_SUBSCRIBED)
return;
return hr;
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry)
{
......@@ -880,10 +880,12 @@ static void session_subscribe_sources(struct media_session *session)
source->object)))
{
WARN("Failed to subscribe to source events, hr %#lx.\n", hr);
return hr;
}
}
session->presentation.flags |= SESSION_FLAG_SOURCES_SUBSCRIBED;
return hr;
}
static void session_start(struct media_session *session, const GUID *time_format, const PROPVARIANT *start_position)
......@@ -909,7 +911,11 @@ static void session_start(struct media_session *session, const GUID *time_format
session->presentation.start_position.vt = VT_EMPTY;
PropVariantCopy(&session->presentation.start_position, start_position);
session_subscribe_sources(session);
if (FAILED(hr = session_subscribe_sources(session)))
{
session_command_complete_with_event(session, MESessionStarted, hr, NULL);
return;
}
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry)
{
......@@ -1308,10 +1314,8 @@ static void session_set_rate(struct media_session *session, BOOL thin, float rat
if (SUCCEEDED(hr))
hr = IMFRateControl_GetRate(session->clock_rate_control, NULL, &clock_rate);
if (SUCCEEDED(hr) && (rate != clock_rate))
if (SUCCEEDED(hr) && (rate != clock_rate) && SUCCEEDED(hr = session_subscribe_sources(session)))
{
session_subscribe_sources(session);
LIST_FOR_EACH_ENTRY(source, &session->presentation.sources, struct media_source, entry)
{
if (SUCCEEDED(hr = MFGetService(source->object, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateControl,
......
......@@ -2465,13 +2465,13 @@ static void test_media_session_events(void)
hr = IMFMediaSession_Start(session, &GUID_NULL, &propvar);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = wait_media_event_until_blocking(session, callback, MESessionStarted, 1000, &propvar);
todo_wine ok(hr == 0x80001234, "Unexpected hr %#lx.\n", hr);
ok(hr == 0x80001234, "Unexpected hr %#lx.\n", hr);
ok(propvar.vt == VT_EMPTY, "got vt %u\n", propvar.vt);
ok(propvar.punkVal != (IUnknown *)topology, "got punkVal %p\n", propvar.punkVal);
PropVariantClear(&propvar);
CHECK_CALLED(test_source_BeginGetEvent);
todo_wine { CHECK_NOT_CALLED(test_source_Start); }
CHECK_NOT_CALLED(test_source_Start);
hr = IMFMediaSession_ClearTopologies(session);
ok(hr == S_OK, "Unexpected hr %#lx.\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