Revert "dsound: Allow inactive devices to change the primary format.".
This reverts commit 4fbe6f3e76
.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5df297206d
commit
b25e1aefc7
|
@ -478,30 +478,35 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
|
||||||
RtlAcquireResourceExclusive(&(device->buffer_list_lock), TRUE);
|
RtlAcquireResourceExclusive(&(device->buffer_list_lock), TRUE);
|
||||||
EnterCriticalSection(&(device->mixlock));
|
EnterCriticalSection(&(device->mixlock));
|
||||||
|
|
||||||
old_fmt = device->primary_pwfx;
|
if (device->priolevel == DSSCL_WRITEPRIMARY) {
|
||||||
device->primary_pwfx = DSOUND_CopyFormat(passed_fmt);
|
old_fmt = device->primary_pwfx;
|
||||||
fmtex = (WAVEFORMATEXTENSIBLE *)device->primary_pwfx;
|
device->primary_pwfx = DSOUND_CopyFormat(passed_fmt);
|
||||||
if (device->primary_pwfx == NULL) {
|
fmtex = (WAVEFORMATEXTENSIBLE *)device->primary_pwfx;
|
||||||
err = DSERR_OUTOFMEMORY;
|
if (device->primary_pwfx == NULL) {
|
||||||
goto out;
|
err = DSERR_OUTOFMEMORY;
|
||||||
}
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (fmtex->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
|
if (fmtex->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
|
||||||
fmtex->Samples.wValidBitsPerSample == 0) {
|
fmtex->Samples.wValidBitsPerSample == 0) {
|
||||||
TRACE("Correcting 0 valid bits per sample\n");
|
TRACE("Correcting 0 valid bits per sample\n");
|
||||||
fmtex->Samples.wValidBitsPerSample = fmtex->Format.wBitsPerSample;
|
fmtex->Samples.wValidBitsPerSample = fmtex->Format.wBitsPerSample;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(device->priolevel == DSSCL_WRITEPRIMARY || device->nrofbuffers == 0)
|
|
||||||
err = DSOUND_ReopenDevice(device, TRUE);
|
err = DSOUND_ReopenDevice(device, TRUE);
|
||||||
if (FAILED(err) && device->priolevel == DSSCL_WRITEPRIMARY) {
|
if (FAILED(err)) {
|
||||||
ERR("No formats could be opened\n");
|
ERR("No formats could be opened\n");
|
||||||
HeapFree(GetProcessHeap(), 0, device->primary_pwfx);
|
HeapFree(GetProcessHeap(), 0, device->primary_pwfx);
|
||||||
device->primary_pwfx = old_fmt;
|
device->primary_pwfx = old_fmt;
|
||||||
|
} else
|
||||||
|
HeapFree(GetProcessHeap(), 0, old_fmt);
|
||||||
} else {
|
} else {
|
||||||
/* ignore failures */
|
WAVEFORMATEX *wfx = DSOUND_CopyFormat(passed_fmt);
|
||||||
err = S_OK;
|
if (wfx) {
|
||||||
HeapFree(GetProcessHeap(), 0, old_fmt);
|
HeapFree(GetProcessHeap(), 0, device->primary_pwfx);
|
||||||
|
device->primary_pwfx = wfx;
|
||||||
|
} else
|
||||||
|
err = DSERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Reference in New Issue