Commit b25e1aef authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

Revert "dsound: Allow inactive devices to change the primary format.".

This reverts commit 4fbe6f3e. Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 5df29720
......@@ -478,6 +478,7 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
RtlAcquireResourceExclusive(&(device->buffer_list_lock), TRUE);
EnterCriticalSection(&(device->mixlock));
if (device->priolevel == DSSCL_WRITEPRIMARY) {
old_fmt = device->primary_pwfx;
device->primary_pwfx = DSOUND_CopyFormat(passed_fmt);
fmtex = (WAVEFORMATEXTENSIBLE *)device->primary_pwfx;
......@@ -492,16 +493,20 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
fmtex->Samples.wValidBitsPerSample = fmtex->Format.wBitsPerSample;
}
if(device->priolevel == DSSCL_WRITEPRIMARY || device->nrofbuffers == 0)
err = DSOUND_ReopenDevice(device, TRUE);
if (FAILED(err) && device->priolevel == DSSCL_WRITEPRIMARY) {
if (FAILED(err)) {
ERR("No formats could be opened\n");
HeapFree(GetProcessHeap(), 0, device->primary_pwfx);
device->primary_pwfx = old_fmt;
} else {
/* ignore failures */
err = S_OK;
} else
HeapFree(GetProcessHeap(), 0, old_fmt);
} else {
WAVEFORMATEX *wfx = DSOUND_CopyFormat(passed_fmt);
if (wfx) {
HeapFree(GetProcessHeap(), 0, device->primary_pwfx);
device->primary_pwfx = wfx;
} else
err = DSERR_OUTOFMEMORY;
}
out:
......
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