Using a longer segment gets rid of the weird SEGALMOSTEND inversion.
From: Rémi Bernon rbernon@codeweavers.com
Then send them again with DMUS_PMSGF_TOOL_ATTIME for the notification queue. --- dlls/dmime/performance.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index 942452d353e..b58a7d9cd18 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -199,7 +199,7 @@ static HRESULT performance_send_notification_pmsg(struct performance *This, MUSI return hr;
msg->mtTime = music_time; - msg->dwFlags = DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_QUEUE; + msg->dwFlags = DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_TOOL_IMMEDIATE; msg->dwType = DMUS_PMSGT_NOTIFICATION; if ((msg->punkUser = object)) IUnknown_AddRef(object); msg->guidNotificationType = type; @@ -1230,7 +1230,7 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface, hr = performance_send_notification_pmsg(This, start_time, This->notification_segment, GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART, (IUnknown *)state); if (SUCCEEDED(hr)) - hr = performance_send_pmsg(This, start_time, DMUS_PMSGF_TOOL_QUEUE, DMUS_PMSGT_DIRTY, NULL); + hr = performance_send_pmsg(This, start_time, DMUS_PMSGF_TOOL_IMMEDIATE, DMUS_PMSGT_DIRTY, NULL);
if (SUCCEEDED(hr)) hr = segment_state_play(state, iface); @@ -1242,7 +1242,7 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface, hr = performance_send_notification_pmsg(This, start_time + length, This->notification_segment, GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND, (IUnknown *)state); if (SUCCEEDED(hr)) - hr = performance_send_pmsg(This, start_time + length, DMUS_PMSGF_TOOL_QUEUE, DMUS_PMSGT_DIRTY, NULL); + hr = performance_send_pmsg(This, start_time + length, DMUS_PMSGF_TOOL_IMMEDIATE, DMUS_PMSGT_DIRTY, NULL); if (SUCCEEDED(hr)) hr = performance_send_notification_pmsg(This, start_time + length, This->notification_performance, GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTOPPED, NULL); @@ -1790,6 +1790,21 @@ static HRESULT WINAPI performance_tool_ProcessPMsg(IDirectMusicTool *iface, enabled = This->notification_segment; if (!enabled) return DMUS_S_FREE;
+ if (msg->dwFlags & DMUS_PMSGF_TOOL_IMMEDIATE) + { + /* re-send the message for queueing at the expected time */ + msg->dwFlags &= ~DMUS_PMSGF_TOOL_IMMEDIATE; + msg->dwFlags |= DMUS_PMSGF_TOOL_ATTIME; + + if (FAILED(hr = IDirectMusicPerformance8_SendPMsg(performance, (DMUS_PMSG *)msg))) + { + ERR("Failed to send notification message, hr %#lx\n", hr); + return DMUS_S_FREE; + } + + return S_OK; + } + list_add_tail(&This->notifications, &message->entry);
/* discard old notification messages */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/tests/dmime.c | 105 +++++++++++++++++++++++++++++---------- 1 file changed, 78 insertions(+), 27 deletions(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 85ea8fcfeff..35a6fbc98f4 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -566,6 +566,7 @@ struct test_track BOOL initialized; BOOL downloaded; BOOL playing; + BOOL test_play; HANDLE playing_event; };
@@ -659,6 +660,8 @@ static HRESULT WINAPI test_track_Play(IDirectMusicTrack *iface, void *state_data { struct test_track *This = impl_from_IDirectMusicTrack(iface);
+ if (!This->test_play) return S_OK; + ok(state_data == &This->data, "got %p\n", state_data); ok(start_time == 50, "got %lu\n", start_time); ok(end_time == 100, "got %lu\n", end_time); @@ -718,15 +721,15 @@ static HRESULT WINAPI test_track_IsParamSupported(IDirectMusicTrack *iface, REFG
static HRESULT WINAPI test_track_AddNotificationType(IDirectMusicTrack *iface, REFGUID type) { - struct test_track *This = impl_from_IDirectMusicTrack(iface); - ok(0, "unexpected %s %p\n", __func__, This); + ok(IsEqualGUID(type, &GUID_NOTIFICATION_SEGMENT) || IsEqualGUID(type, &GUID_NOTIFICATION_PERFORMANCE), + "got %s\n", debugstr_guid(type)); return E_NOTIMPL; }
static HRESULT WINAPI test_track_RemoveNotificationType(IDirectMusicTrack *iface, REFGUID type) { - struct test_track *This = impl_from_IDirectMusicTrack(iface); - ok(0, "unexpected %s %p\n", __func__, This); + ok(IsEqualGUID(type, &GUID_NOTIFICATION_SEGMENT) || IsEqualGUID(type, &GUID_NOTIFICATION_PERFORMANCE), + "got %s\n", debugstr_guid(type)); return E_NOTIMPL; }
@@ -755,7 +758,7 @@ static const IDirectMusicTrackVtbl test_track_vtbl = test_track_Clone, };
-static HRESULT test_track_create(IDirectMusicTrack **ret_iface) +static HRESULT test_track_create(IDirectMusicTrack **ret_iface, BOOL test_play) { struct test_track *track;
@@ -763,6 +766,7 @@ static HRESULT test_track_create(IDirectMusicTrack **ret_iface) if (!(track = calloc(1, sizeof(*track)))) return E_OUTOFMEMORY; track->IDirectMusicTrack_iface.lpVtbl = &test_track_vtbl; track->ref = 1; + track->test_play = test_play;
track->playing_event = CreateEventW(NULL, FALSE, FALSE, NULL); ok(!!track->playing_event, "CreateEventW failed, error %lu\n", GetLastError()); @@ -3015,6 +3019,8 @@ static void check_dmus_notification_pmsg_(int line, DMUS_NOTIFICATION_PMSG *msg, "got dwType %#lx\n", msg->dwType); ok_(__FILE__, line)(IsEqualGUID(&msg->guidNotificationType, type), "got guidNotificationType %s\n", debugstr_guid(&msg->guidNotificationType)); + todo_wine_if(IsEqualGUID(type, &GUID_NOTIFICATION_SEGMENT) && + (option == DMUS_NOTIFICATION_SEGALMOSTEND || option == DMUS_NOTIFICATION_SEGEND)) ok_(__FILE__, line)(msg->dwNotificationOption == option, "got dwNotificationOption %#lx\n", msg->dwNotificationOption); ok_(__FILE__, line)(!msg->dwField1, "got dwField1 %lu\n", msg->dwField1); @@ -3038,8 +3044,11 @@ static void test_notification_pmsg(void) DMUS_PMSGT_WAVE, }; IDirectMusicPerformance *performance; + IDirectMusicSegmentState *state; DMUS_NOTIFICATION_PMSG *notif; + MUSIC_TIME music_time, length; IDirectMusicSegment *segment; + IDirectMusicTrack *track; IDirectMusicGraph *graph; IDirectMusicTool *tool; DMUS_PMSG *msg; @@ -3070,6 +3079,21 @@ static void test_notification_pmsg(void) &IID_IDirectMusicSegment, (void **)&segment); ok(hr == S_OK, "got %#lx\n", hr);
+ + /* native needs a track or the segment will end immediately */ + + hr = test_track_create(&track, FALSE); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicSegment_InsertTrack(segment, track, 1); + ok(hr == S_OK, "got %#lx\n", hr); + IDirectMusicTrack_Release(track); + + /* native sends dirty / notification by batch of 1s, shorter length + * will cause all messages to be received immediately */ + length = 10005870 / 6510; + hr = IDirectMusicSegment_SetLength(segment, length); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicSegment8_Download((IDirectMusicSegment8 *)segment, (IUnknown *)performance); ok(hr == S_OK, "got %#lx\n", hr); hr = IDirectMusicSegment8_Unload((IDirectMusicSegment8 *)segment, (IUnknown *)performance); @@ -3077,14 +3101,18 @@ static void test_notification_pmsg(void)
hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, NULL); ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicPerformance_GetTime(performance, NULL, &music_time); + ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, &msg); + ret = test_tool_wait_message(tool, 50, &msg); ok(!ret, "got %#lx\n", ret); ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, &msg); + ret = test_tool_wait_message(tool, 50, &msg); + todo_wine ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret); + if (ret == WAIT_TIMEOUT) ret = test_tool_wait_message(tool, 500, &msg); ok(!ret, "got %#lx\n", ret); ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); hr = IDirectMusicPerformance_FreePMsg(performance, msg); @@ -3104,22 +3132,24 @@ static void test_notification_pmsg(void) hr = IDirectMusicPerformance_AddNotificationType(performance, &GUID_NOTIFICATION_SEGMENT); ok(hr == S_FALSE, "got %#lx\n", hr);
- hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, NULL); + hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, &state); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicPerformance_GetTime(performance, NULL, &music_time); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)¬if); + ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTARTED); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)¬if); + ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, &msg); + ret = test_tool_wait_message(tool, 50, &msg); ok(!ret, "got %#lx\n", ret); ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); hr = IDirectMusicPerformance_FreePMsg(performance, msg); @@ -3127,37 +3157,35 @@ static void test_notification_pmsg(void)
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND); + check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)¬if); + ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND); + check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, &msg); + ret = test_tool_wait_message(tool, 50, &msg); ok(!ret, "got %#lx\n", ret); ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)¬if); + ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTOPPED); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 100, &msg); + + /* wait enough time for notifications to be delivered */ + + ret = test_tool_wait_message(tool, 2000, &msg); ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret); ok(!msg, "got %p\n", msg);
- hr = IDirectMusicPerformance_RemoveNotificationType(performance, &GUID_NOTIFICATION_PERFORMANCE); - ok(hr == S_OK, "got %#lx\n", hr); - hr = IDirectMusicPerformance_RemoveNotificationType(performance, &GUID_NOTIFICATION_SEGMENT); - ok(hr == S_OK, "got %#lx\n", hr); -
/* notification messages are also queued for direct access */
@@ -3175,13 +3203,13 @@ static void test_notification_pmsg(void)
hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_OK, "got %#lx\n", hr); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND); + check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_OK, "got %#lx\n", hr); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND); + check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
@@ -3194,6 +3222,13 @@ static void test_notification_pmsg(void) hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_FALSE, "got %#lx\n", hr);
+ IDirectMusicSegmentState_Release(state); + + hr = IDirectMusicPerformance_RemoveNotificationType(performance, &GUID_NOTIFICATION_PERFORMANCE); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicPerformance_RemoveNotificationType(performance, &GUID_NOTIFICATION_SEGMENT); + ok(hr == S_OK, "got %#lx\n", hr); +
/* RemoveNotificationType returns S_FALSE if already removed */
@@ -3205,10 +3240,12 @@ static void test_notification_pmsg(void)
hr = IDirectMusicPerformance_AddNotificationType(performance, &GUID_NOTIFICATION_SEGMENT); ok(hr == S_OK, "got %#lx\n", hr); - hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, NULL); + hr = IDirectMusicPerformance_PlaySegment(performance, segment, 0, 0, &state); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicPerformance_GetTime(performance, NULL, &music_time); ok(hr == S_OK, "got %#lx\n", hr);
- ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)¬if); + ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); @@ -3216,8 +3253,22 @@ static void test_notification_pmsg(void)
hr = IDirectMusicPerformance_CloseDown(performance); ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); + ok(hr == S_FALSE, "got %#lx\n", hr); hr = IDirectMusicPerformance_RemoveNotificationType(performance, &GUID_NOTIFICATION_SEGMENT); ok(hr == S_FALSE, "got %#lx\n", hr); + + ret = test_tool_wait_message(tool, 50, &msg); + ok(!ret, "got %#lx\n", ret); + ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); + hr = IDirectMusicPerformance_FreePMsg(performance, msg); + ok(hr == S_OK, "got %#lx\n", hr); + + ret = test_tool_wait_message(tool, 500, &msg); + todo_wine ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret); + if (!ret) IDirectMusicPerformance_FreePMsg(performance, msg); + + IDirectMusicSegmentState_Release(state); IDirectMusicSegment_Release(segment);
@@ -3856,7 +3907,7 @@ static void test_segment_state(void)
hr = test_tool_create(message_types, ARRAY_SIZE(message_types), &tool); ok(hr == S_OK, "got %#lx\n", hr); - hr = test_track_create(&track); + hr = test_track_create(&track, TRUE); ok(hr == S_OK, "got %#lx\n", hr);
hr = CoCreateInstance(&CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC_SERVER,
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/performance.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index b58a7d9cd18..3fc5df80b58 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -1203,8 +1203,8 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface, { struct performance *This = impl_from_IDirectMusicPerformance8(iface); IDirectMusicSegmentState *state; + MUSIC_TIME length, music_time; IDirectMusicSegment *segment; - MUSIC_TIME length; HRESULT hr;
FIXME("(%p, %p, %s, %p, %#lx, %I64d, %p, %p, %p): stub\n", This, source, debugstr_w(segment_name), @@ -1216,7 +1216,8 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface,
if (FAILED(hr = IUnknown_QueryInterface(source, &IID_IDirectMusicSegment, (void **)&segment))) return hr; - if (FAILED(hr = segment_state_create(segment, start_time, iface, &state))) + if ((!(music_time = start_time) && FAILED(hr = IDirectMusicPerformance8_GetTime(iface, NULL, &music_time))) + || FAILED(hr = segment_state_create(segment, music_time, iface, &state))) { IDirectMusicSegment_Release(segment); return hr; @@ -1224,27 +1225,27 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface,
hr = IDirectMusicSegment_GetLength(segment, &length); if (SUCCEEDED(hr)) - hr = performance_send_notification_pmsg(This, start_time, This->notification_performance, + hr = performance_send_notification_pmsg(This, music_time, This->notification_performance, GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTARTED, NULL); if (SUCCEEDED(hr)) - hr = performance_send_notification_pmsg(This, start_time, This->notification_segment, + hr = performance_send_notification_pmsg(This, music_time, This->notification_segment, GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART, (IUnknown *)state); if (SUCCEEDED(hr)) - hr = performance_send_pmsg(This, start_time, DMUS_PMSGF_TOOL_IMMEDIATE, DMUS_PMSGT_DIRTY, NULL); + hr = performance_send_pmsg(This, music_time, DMUS_PMSGF_TOOL_IMMEDIATE, DMUS_PMSGT_DIRTY, NULL);
if (SUCCEEDED(hr)) hr = segment_state_play(state, iface);
if (SUCCEEDED(hr)) - hr = performance_send_notification_pmsg(This, start_time + length, This->notification_segment, + hr = performance_send_notification_pmsg(This, music_time + length, This->notification_segment, GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND, (IUnknown *)state); if (SUCCEEDED(hr)) - hr = performance_send_notification_pmsg(This, start_time + length, This->notification_segment, + hr = performance_send_notification_pmsg(This, music_time + length, This->notification_segment, GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND, (IUnknown *)state); if (SUCCEEDED(hr)) - hr = performance_send_pmsg(This, start_time + length, DMUS_PMSGF_TOOL_IMMEDIATE, DMUS_PMSGT_DIRTY, NULL); + hr = performance_send_pmsg(This, music_time + length, DMUS_PMSGF_TOOL_IMMEDIATE, DMUS_PMSGT_DIRTY, NULL); if (SUCCEEDED(hr)) - hr = performance_send_notification_pmsg(This, start_time + length, This->notification_performance, + hr = performance_send_notification_pmsg(This, music_time + length, This->notification_performance, GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTOPPED, NULL);
if (SUCCEEDED(hr) && segment_state)
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/performance.c | 6 +++--- dlls/dmime/tests/dmime.c | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index 3fc5df80b58..83c2401c083 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -1237,11 +1237,11 @@ static HRESULT WINAPI performance_PlaySegmentEx(IDirectMusicPerformance8 *iface, hr = segment_state_play(state, iface);
if (SUCCEEDED(hr)) - hr = performance_send_notification_pmsg(This, music_time + length, This->notification_segment, - GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND, (IUnknown *)state); + hr = performance_send_notification_pmsg(This, music_time + length - 1450, This->notification_segment, + GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND, (IUnknown *)state); if (SUCCEEDED(hr)) hr = performance_send_notification_pmsg(This, music_time + length, This->notification_segment, - GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND, (IUnknown *)state); + GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND, (IUnknown *)state); if (SUCCEEDED(hr)) hr = performance_send_pmsg(This, music_time + length, DMUS_PMSGF_TOOL_IMMEDIATE, DMUS_PMSGT_DIRTY, NULL); if (SUCCEEDED(hr)) diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 35a6fbc98f4..dc9e98aab0f 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -3019,8 +3019,6 @@ static void check_dmus_notification_pmsg_(int line, DMUS_NOTIFICATION_PMSG *msg, "got dwType %#lx\n", msg->dwType); ok_(__FILE__, line)(IsEqualGUID(&msg->guidNotificationType, type), "got guidNotificationType %s\n", debugstr_guid(&msg->guidNotificationType)); - todo_wine_if(IsEqualGUID(type, &GUID_NOTIFICATION_SEGMENT) && - (option == DMUS_NOTIFICATION_SEGALMOSTEND || option == DMUS_NOTIFICATION_SEGEND)) ok_(__FILE__, line)(msg->dwNotificationOption == option, "got dwNotificationOption %#lx\n", msg->dwNotificationOption); ok_(__FILE__, line)(!msg->dwField1, "got dwField1 %lu\n", msg->dwField1);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/tests/dmime.c | 91 ++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 21 deletions(-)
diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index dc9e98aab0f..05dc653a935 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -3011,12 +3011,50 @@ static void test_performance_pmsg(void) IDirectMusicTool_Release(tool); }
-#define check_dmus_notification_pmsg(a, b, c) check_dmus_notification_pmsg_(__LINE__, a, b, c) -static void check_dmus_notification_pmsg_(int line, DMUS_NOTIFICATION_PMSG *msg, - const GUID *type, DWORD option) +#define check_dmus_dirty_pmsg(a, b) check_dmus_dirty_pmsg_(__LINE__, a, b) +static void check_dmus_dirty_pmsg_(int line, DMUS_PMSG *msg, MUSIC_TIME music_time) { - ok_(__FILE__, line)(msg->dwType == DMUS_PMSGT_NOTIFICATION, - "got dwType %#lx\n", msg->dwType); + ok_(__FILE__, line)(msg->dwSize == sizeof(*msg), "got dwSize %#lx\n", msg->dwSize); + ok_(__FILE__, line)(abs(msg->mtTime - music_time) <= 100, "got mtTime %ld\n", msg->mtTime); + ok_(__FILE__, line)(msg->dwFlags == (DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_REFTIME | DMUS_PMSGF_TOOL_IMMEDIATE), + "got dwFlags %#lx\n", msg->dwFlags); + ok_(__FILE__, line)(msg->dwPChannel == 0, "got dwPChannel %#lx\n", msg->dwPChannel); + ok_(__FILE__, line)(msg->dwVirtualTrackID == 0, "got dwVirtualTrackID %#lx\n", msg->dwVirtualTrackID); + ok_(__FILE__, line)(msg->pTool != 0, "got pTool %p\n", msg->pTool); + ok_(__FILE__, line)(msg->pGraph != 0, "got pGraph %p\n", msg->pGraph); + ok_(__FILE__, line)(msg->dwType == DMUS_PMSGT_DIRTY, "got dwType %#lx\n", msg->dwType); + ok_(__FILE__, line)(msg->dwVoiceID == 0, "got dwVoiceID %#lx\n", msg->dwVoiceID); + todo_wine ok_(__FILE__, line)(msg->dwGroupID == -1, "got dwGroupID %#lx\n", msg->dwGroupID); + ok_(__FILE__, line)(msg->punkUser == 0, "got punkUser %p\n", msg->punkUser); +} + +#define check_dmus_notification_pmsg(a, b, c, d, e, f) check_dmus_notification_pmsg_(__LINE__, a, b, c, d, e, f) +static void check_dmus_notification_pmsg_(int line, DMUS_NOTIFICATION_PMSG *msg, MUSIC_TIME music_time, DWORD flags, + const GUID *type, DWORD option, void *user) +{ + ok_(__FILE__, line)(msg->dwSize == sizeof(*msg), "got dwSize %#lx\n", msg->dwSize); + ok_(__FILE__, line)(msg->rtTime > 0, "got rtTime %I64d\n", msg->rtTime); + ok_(__FILE__, line)(abs(msg->mtTime - music_time) <= 100, "got mtTime %ld\n", msg->mtTime); + todo_wine_if(flags == DMUS_PMSGF_TOOL_ATTIME) + ok_(__FILE__, line)(msg->dwFlags == (DMUS_PMSGF_MUSICTIME | DMUS_PMSGF_REFTIME | flags), + "got dwFlags %#lx\n", msg->dwFlags); + ok_(__FILE__, line)(msg->dwPChannel == 0, "got dwPChannel %#lx\n", msg->dwPChannel); + ok_(__FILE__, line)(msg->dwVirtualTrackID == 0, "got dwVirtualTrackID %#lx\n", msg->dwVirtualTrackID); + if (flags == DMUS_PMSGF_TOOL_ATTIME) + { + todo_wine ok_(__FILE__, line)(msg->pTool == 0, "got pTool %p\n", msg->pTool); + ok_(__FILE__, line)(msg->pGraph == 0, "got pGraph %p\n", msg->pGraph); + } + else + { + ok_(__FILE__, line)(msg->pTool != 0, "got pTool %p\n", msg->pTool); + ok_(__FILE__, line)(msg->pGraph != 0, "got pGraph %p\n", msg->pGraph); + } + ok_(__FILE__, line)(msg->dwType == DMUS_PMSGT_NOTIFICATION, "got dwType %#lx\n", msg->dwType); + ok_(__FILE__, line)(msg->dwVoiceID == 0, "got dwVoiceID %#lx\n", msg->dwVoiceID); + todo_wine ok_(__FILE__, line)(msg->dwGroupID == -1, "got dwGroupID %#lx\n", msg->dwGroupID); + ok_(__FILE__, line)(msg->punkUser == (IUnknown *)user, "got punkUser %p\n", msg->punkUser); + ok_(__FILE__, line)(IsEqualGUID(&msg->guidNotificationType, type), "got guidNotificationType %s\n", debugstr_guid(&msg->guidNotificationType)); ok_(__FILE__, line)(msg->dwNotificationOption == option, @@ -3104,7 +3142,7 @@ static void test_notification_pmsg(void)
ret = test_tool_wait_message(tool, 50, &msg); ok(!ret, "got %#lx\n", ret); - ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); + check_dmus_dirty_pmsg(msg, music_time); hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
@@ -3112,7 +3150,7 @@ static void test_notification_pmsg(void) todo_wine ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret); if (ret == WAIT_TIMEOUT) ret = test_tool_wait_message(tool, 500, &msg); ok(!ret, "got %#lx\n", ret); - ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); + check_dmus_dirty_pmsg(msg, music_time + length); hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
@@ -3137,43 +3175,48 @@ static void test_notification_pmsg(void)
ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTARTED); + check_dmus_notification_pmsg(notif, music_time, DMUS_PMSGF_TOOL_IMMEDIATE, &GUID_NOTIFICATION_PERFORMANCE, + DMUS_NOTIFICATION_MUSICSTARTED, NULL); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART); + check_dmus_notification_pmsg(notif, music_time, DMUS_PMSGF_TOOL_IMMEDIATE, &GUID_NOTIFICATION_SEGMENT, + DMUS_NOTIFICATION_SEGSTART, state); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 50, &msg); ok(!ret, "got %#lx\n", ret); - ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); + check_dmus_dirty_pmsg(msg, music_time); hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 500, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND); + check_dmus_notification_pmsg(notif, music_time + length - 1450, DMUS_PMSGF_TOOL_IMMEDIATE, &GUID_NOTIFICATION_SEGMENT, + DMUS_NOTIFICATION_SEGALMOSTEND, state); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND); + check_dmus_notification_pmsg(notif, music_time + length, DMUS_PMSGF_TOOL_IMMEDIATE, &GUID_NOTIFICATION_SEGMENT, + DMUS_NOTIFICATION_SEGEND, state); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 50, &msg); ok(!ret, "got %#lx\n", ret); - ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); + check_dmus_dirty_pmsg(msg, music_time + length); hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTOPPED); + check_dmus_notification_pmsg(notif, music_time + length, DMUS_PMSGF_TOOL_IMMEDIATE, &GUID_NOTIFICATION_PERFORMANCE, + DMUS_NOTIFICATION_MUSICSTOPPED, NULL); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
@@ -3189,31 +3232,36 @@ static void test_notification_pmsg(void)
hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_OK, "got %#lx\n", hr); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTARTED); + check_dmus_notification_pmsg(notif, music_time, DMUS_PMSGF_TOOL_ATTIME, &GUID_NOTIFICATION_PERFORMANCE, + DMUS_NOTIFICATION_MUSICSTARTED, NULL); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_OK, "got %#lx\n", hr); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART); + check_dmus_notification_pmsg(notif, music_time, DMUS_PMSGF_TOOL_ATTIME, &GUID_NOTIFICATION_SEGMENT, + DMUS_NOTIFICATION_SEGSTART, state); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_OK, "got %#lx\n", hr); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGALMOSTEND); + check_dmus_notification_pmsg(notif, music_time + length - 1450, DMUS_PMSGF_TOOL_ATTIME, &GUID_NOTIFICATION_SEGMENT, + DMUS_NOTIFICATION_SEGALMOSTEND, state); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_OK, "got %#lx\n", hr); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGEND); + check_dmus_notification_pmsg(notif, music_time + length, DMUS_PMSGF_TOOL_ATTIME, &GUID_NOTIFICATION_SEGMENT, + DMUS_NOTIFICATION_SEGEND, state); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
hr = IDirectMusicPerformance_GetNotificationPMsg(performance, ¬if); ok(hr == S_OK, "got %#lx\n", hr); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_PERFORMANCE, DMUS_NOTIFICATION_MUSICSTOPPED); + check_dmus_notification_pmsg(notif, music_time + length, DMUS_PMSGF_TOOL_ATTIME, &GUID_NOTIFICATION_PERFORMANCE, + DMUS_NOTIFICATION_MUSICSTOPPED, NULL); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
@@ -3245,7 +3293,8 @@ static void test_notification_pmsg(void)
ret = test_tool_wait_message(tool, 50, (DMUS_PMSG **)¬if); ok(!ret, "got %#lx\n", ret); - check_dmus_notification_pmsg(notif, &GUID_NOTIFICATION_SEGMENT, DMUS_NOTIFICATION_SEGSTART); + check_dmus_notification_pmsg(notif, music_time, DMUS_PMSGF_TOOL_IMMEDIATE, &GUID_NOTIFICATION_SEGMENT, + DMUS_NOTIFICATION_SEGSTART, state); hr = IDirectMusicPerformance_FreePMsg(performance, (DMUS_PMSG *)notif); ok(hr == S_OK, "got %#lx\n", hr);
@@ -3258,7 +3307,7 @@ static void test_notification_pmsg(void)
ret = test_tool_wait_message(tool, 50, &msg); ok(!ret, "got %#lx\n", ret); - ok(msg->dwType == DMUS_PMSGT_DIRTY, "got %#lx\n", msg->dwType); + check_dmus_dirty_pmsg(msg, music_time); hr = IDirectMusicPerformance_FreePMsg(performance, msg); ok(hr == S_OK, "got %#lx\n", hr);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=139591
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 448 dmime.c:3235: Test failed: got punkUser 01758DD0 dmime.c:3242: Test failed: got mtTime 1831 dmime.c:3249: Test failed: got mtTime 1831 dmime.c:3249: Test failed: got punkUser 00000000 0604:dmime: unhandled exception c0000005 at 0038EFB6
=== w7u_adm (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 1838 dmime.c:3235: Test failed: got punkUser 00BCD168 dmime.c:3242: Test failed: got mtTime 1838 dmime.c:3242: Test failed: got punkUser 00000000 0564:dmime: unhandled exception c0000005 at 011DEFB6
=== w7u_el (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 448 dmime.c:3235: Test failed: got punkUser 009C2500 dmime.c:3242: Test failed: got mtTime 1831 dmime.c:3249: Test failed: got mtTime 1831 dmime.c:3249: Test failed: got punkUser 00000000 0a74:dmime: unhandled exception c0000005 at 0019EFB6
=== w8 (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 331 dmime.c:3235: Test failed: got punkUser 035A3570 dmime.c:3242: Test failed: got mtTime 1714 dmime.c:3249: Test failed: got mtTime 1714 dmime.c:3249: Test failed: got punkUser 00000000 0bfc:dmime: unhandled exception c0000005 at 00D7EFB6
=== w8adm (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 331 dmime.c:3235: Test failed: got punkUser 013AECA8 dmime.c:3242: Test failed: got mtTime 1715 dmime.c:3249: Test failed: got mtTime 1715 dmime.c:3249: Test failed: got punkUser 00000000 0a8c:dmime: unhandled exception c0000005 at 0030EFB6
=== w864 (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 464 dmime.c:3235: Test failed: got punkUser 006DEC10 dmime.c:3242: Test failed: got mtTime 1846 dmime.c:3249: Test failed: got mtTime 1846 dmime.c:3249: Test failed: got punkUser 00000000 0a9c:dmime: unhandled exception c0000005 at 0093EFB6
=== w1064v1507 (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 461 dmime.c:3235: Test failed: got punkUser 0419DED8 dmime.c:3242: Test failed: got mtTime 1845 dmime.c:3249: Test failed: got mtTime 1845 dmime.c:3249: Test failed: got punkUser 00000000 039c:dmime: unhandled exception c0000005 at 00AAEFB6
=== w1064v1809 (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 461 dmime.c:3235: Test failed: got punkUser 00C4DA60 dmime.c:3242: Test failed: got mtTime 1845 dmime.c:3249: Test failed: got mtTime 1845 dmime.c:3249: Test failed: got punkUser 00000000 1e38:dmime: unhandled exception c0000005 at 0113EFB6
=== w1064_tsign (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 463 dmime.c:3235: Test failed: got punkUser 0424E500 dmime.c:3242: Test failed: got mtTime 1845 dmime.c:3249: Test failed: got mtTime 1845 dmime.c:3249: Test failed: got punkUser 00000000
=== w10pro64 (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 467 dmime.c:3235: Test failed: got punkUser 047C70B0 dmime.c:3242: Test failed: got mtTime 1849 dmime.c:3249: Test failed: got mtTime 1849 dmime.c:3249: Test failed: got punkUser 00000000 200c:dmime: unhandled exception c0000005 at 00AFEFB6
=== w10pro64_en_AE_u8 (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 311 dmime.c:3235: Test failed: got punkUser 030ABE58 dmime.c:3242: Test failed: got mtTime 1694 dmime.c:3249: Test failed: got mtTime 1694 dmime.c:3249: Test failed: got punkUser 00000000 23ac:dmime: unhandled exception c0000005 at 003CEFB6
=== w11pro64 (32 bit report) ===
dmime: dmime.c:3235: Test failed: got mtTime 310 dmime.c:3235: Test failed: got punkUser 03E65C30 dmime.c:3242: Test failed: got mtTime 1693 dmime.c:3249: Test failed: got mtTime 1693 dmime.c:3249: Test failed: got punkUser 00000000 10f0:dmime: unhandled exception c0000005 at 0049EFB6
The 1450 from `dmime: Send DMUS_NOTIFICATION_SEGALMOSTEND before DMUS_NOTIFICATION_SEGEND`: Is that coming from some documentation or from experiments?
Test failures are unrelated (ddraw, device.c and win.c).
This merge request was approved by Michael Stefaniuc.
On Mon Nov 6 19:35:03 2023 +0000, Michael Stefaniuc wrote:
The 1450 from `dmime: Send DMUS_NOTIFICATION_SEGALMOSTEND before DMUS_NOTIFICATION_SEGEND`: Is that coming from some documentation or from experiments?
From some local testing, although I don't remember it to be very accurate (or to matter very much).