Subject: [PATCH 1/2 (try2)] mmdevapi: Don't fail if dwChannelMask is not set correctly

Joerg-Cyril.Hoehle at Joerg-Cyril.Hoehle at
Fri Sep 30 10:56:30 CDT 2011


Andrew Eikum writes:
>(try2): Remove the test found by testbot. My Win7 Home VM passed that
>test, so it seems we can expect any behavior.

I object to the removal of the test like that.  It should be
replaced with a comment to explain that the behaviour of
IsFormatSupported is very surprising, hence skipped.  Actually, that
behaviour begs for even more tests to understand what's going on.

So far I believed in the invariant:
  IsFormatSupported == S_OK  <=>  Initialize == S_OK
which is verified using all standard formats (1-2 channels),
with one exception on testbot:
render.c:396: Initialize (1, 48000x16x1) returns 8889000f unlike IsFormatSupported
                         ^1^ means in exclusive mode, and only there.

Now you experienced
A. on testbot:
IsFormatSupported(dwChannelMask==FFFF) == S_OK, like Initialize
which conforms to the above invariant
and simply suggests that ChannelMask is not checked at all,
therefore this code in Wine seems too much:
+            fmtex->dwChannelMask != 0 &&
+            fmtex->dwChannelMask != get_channel_mask(pwfx->nChannels))

B. your own Win7 Home system, with dwChannelMask=ffff,
IsFormatSupported returns
+        ok(hr == S_FALSE || hr == AUDCLNT_E_UNSUPPORTED_FORMAT
while Initialize returns
+        ok(hr == S_OK,
which is weird.

When does it return S_FALSE?
In the latter case, is the suggested format anything else than GetMixFormat?

What does exclusive mode return?  Unlike in Wine, the shared mode
"audio engine" mixer is a completely different SW entity than the
exclusive mode "audio device", so it's important to check both.

This needs more testing.  In particular, tests performed on HW that
supports more than 2 channels are welcome.  Based on your surprising
test result, I'd guess yours is such a system.

Unlike DSound, mmdevapi has no GetSpeakerConfig that I'm aware of
(short of Device Topology), so I don't know how apps find out about
multi-channel abilities.  BTW, I believe
+            fmtex->dwChannelMask != get_channel_mask(pwfx->nChannels))
in Wine is bogus anyway, because it's arbitrary.  There exist different
3/4/5/6 channel configurations.

	Jörg Höhle

More information about the wine-devel mailing list