[pkg-wine-party] [SCM] Debian Wine packaging branch, wheezy, updated. wine-1.4-7-302-gb61b690
Alexandre Julliard
julliard at winehq.org
Sun Jun 17 20:04:12 UTC 2012
The following commit has been merged in the wheezy branch:
commit 883cff3c0a79a56b174742e9ec9db38384a8a6ce
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Mon Apr 2 09:41:06 2012 -0500
dsound: Validate and correct wValidBitsPerSample in primary buffer SetFormat.
(cherry picked from commit 552433cf9e195109bbd520bf4eea47ad9afa6d8e)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index 5c74353..4851ac2 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -353,7 +353,7 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
HRESULT err = DSERR_BUFFERLOST;
int i;
WAVEFORMATEX *old_fmt;
- WAVEFORMATEXTENSIBLE *fmtex;
+ WAVEFORMATEXTENSIBLE *fmtex, *passed_fmtex = (WAVEFORMATEXTENSIBLE*)passed_fmt;
BOOL forced = (device->priolevel == DSSCL_WRITEPRIMARY);
TRACE("(%p,%p)\n", device, passed_fmt);
@@ -380,6 +380,11 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
passed_fmt->nBlockAlign != passed_fmt->nChannels * passed_fmt->wBitsPerSample / 8)
return DSERR_INVALIDPARAM;
+ if(passed_fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE){
+ if(passed_fmtex->Samples.wValidBitsPerSample > passed_fmtex->Format.wBitsPerSample)
+ return DSERR_INVALIDPARAM;
+ }
+
/* **** */
RtlAcquireResourceExclusive(&(device->buffer_list_lock), TRUE);
EnterCriticalSection(&(device->mixlock));
@@ -394,6 +399,13 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
goto done;
}
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE){
+ if(fmtex->Samples.wValidBitsPerSample == 0){
+ TRACE("Correcting 0 valid bits per sample\n");
+ fmtex->Samples.wValidBitsPerSample = fmtex->Format.wBitsPerSample;
+ }
+ }
+
DSOUND_PrimaryClose(device);
err = DSOUND_ReopenDevice(device, FALSE);
@@ -427,6 +439,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
device->pwfx->wBitsPerSample = 32;
device->pwfx->nAvgBytesPerSec = passed_fmt->nSamplesPerSec * device->pwfx->nBlockAlign;
device->pwfx->nBlockAlign = passed_fmt->nChannels * (device->pwfx->wBitsPerSample / 8);
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ fmtex->Samples.wValidBitsPerSample = device->pwfx->wBitsPerSample;
err = DSOUND_ReopenDevice(device, FALSE);
if(SUCCEEDED(err))
goto opened;
@@ -434,6 +448,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
device->pwfx->wBitsPerSample = 16;
device->pwfx->nAvgBytesPerSec = passed_fmt->nSamplesPerSec * device->pwfx->nBlockAlign;
device->pwfx->nBlockAlign = passed_fmt->nChannels * (device->pwfx->wBitsPerSample / 8);
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ fmtex->Samples.wValidBitsPerSample = device->pwfx->wBitsPerSample;
err = DSOUND_ReopenDevice(device, FALSE);
if(SUCCEEDED(err))
goto opened;
@@ -441,6 +457,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
device->pwfx->wBitsPerSample = 8;
device->pwfx->nAvgBytesPerSec = passed_fmt->nSamplesPerSec * device->pwfx->nBlockAlign;
device->pwfx->nBlockAlign = passed_fmt->nChannels * (device->pwfx->wBitsPerSample / 8);
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ fmtex->Samples.wValidBitsPerSample = device->pwfx->wBitsPerSample;
err = DSOUND_ReopenDevice(device, FALSE);
if(SUCCEEDED(err))
goto opened;
@@ -449,6 +467,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
device->pwfx->wBitsPerSample = passed_fmt->wBitsPerSample;
device->pwfx->nAvgBytesPerSec = passed_fmt->nSamplesPerSec * device->pwfx->nBlockAlign;
device->pwfx->nBlockAlign = passed_fmt->nChannels * (device->pwfx->wBitsPerSample / 8);
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ fmtex->Samples.wValidBitsPerSample = device->pwfx->wBitsPerSample;
err = DSOUND_ReopenDevice(device, FALSE);
if(SUCCEEDED(err))
goto opened;
@@ -456,6 +476,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
device->pwfx->wBitsPerSample = 32;
device->pwfx->nAvgBytesPerSec = passed_fmt->nSamplesPerSec * device->pwfx->nBlockAlign;
device->pwfx->nBlockAlign = passed_fmt->nChannels * (device->pwfx->wBitsPerSample / 8);
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ fmtex->Samples.wValidBitsPerSample = device->pwfx->wBitsPerSample;
err = DSOUND_ReopenDevice(device, FALSE);
if(SUCCEEDED(err))
goto opened;
@@ -463,6 +485,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
device->pwfx->wBitsPerSample = 16;
device->pwfx->nAvgBytesPerSec = passed_fmt->nSamplesPerSec * device->pwfx->nBlockAlign;
device->pwfx->nBlockAlign = passed_fmt->nChannels * (device->pwfx->wBitsPerSample / 8);
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ fmtex->Samples.wValidBitsPerSample = device->pwfx->wBitsPerSample;
err = DSOUND_ReopenDevice(device, FALSE);
if(SUCCEEDED(err))
goto opened;
@@ -470,6 +494,8 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
device->pwfx->wBitsPerSample = 8;
device->pwfx->nAvgBytesPerSec = passed_fmt->nSamplesPerSec * device->pwfx->nBlockAlign;
device->pwfx->nBlockAlign = passed_fmt->nChannels * (device->pwfx->wBitsPerSample / 8);
+ if(device->pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ fmtex->Samples.wValidBitsPerSample = device->pwfx->wBitsPerSample;
err = DSOUND_ReopenDevice(device, FALSE);
if(SUCCEEDED(err))
goto opened;
--
Debian Wine packaging
More information about the pkg-wine-party
mailing list