mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 18:54:25 +00:00
[DSOUND][WAVE] Workaround crash when recording sound in Scratch 1.4 CORE-13202
It regressed by SVN r44721 == git 356d4bab16092de335705e02b0e87698ec35c393 when #define USE_MMIXER_LIB was removed. Thanks to the patches author Doug Lyons. VBox https://reactos.org/testman/compare.php?ids=77914,77919 LGTM KVM https://reactos.org/testman/compare.php?ids=77913,77918 LGTM
This commit is contained in:
parent
979b7d4d8e
commit
81f8bcea8c
|
@ -846,6 +846,12 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
|
||||||
wfex->nAvgBytesPerSec, wfex->nBlockAlign,
|
wfex->nAvgBytesPerSec, wfex->nBlockAlign,
|
||||||
wfex->wBitsPerSample, wfex->cbSize);
|
wfex->wBitsPerSample, wfex->cbSize);
|
||||||
|
|
||||||
|
/* Do some sanity checks for 'recording' SamplesPerSec value */
|
||||||
|
if (wfex->nSamplesPerSec > 100000)
|
||||||
|
wfex->nSamplesPerSec = 100000;
|
||||||
|
if (wfex->nSamplesPerSec < 5000)
|
||||||
|
wfex->nSamplesPerSec = 5000;
|
||||||
|
|
||||||
device->pwfx = DSOUND_CopyFormat(wfex);
|
device->pwfx = DSOUND_CopyFormat(wfex);
|
||||||
if ( device->pwfx == NULL ) {
|
if ( device->pwfx == NULL ) {
|
||||||
*ppobj = NULL;
|
*ppobj = NULL;
|
||||||
|
|
|
@ -61,6 +61,14 @@ widMessage(
|
||||||
}
|
}
|
||||||
case WIDM_OPEN :
|
case WIDM_OPEN :
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Do sanity checks for 'recording' SamplesPerSec value */
|
||||||
|
LPWAVEOPENDESC OpenParameters = (LPWAVEOPENDESC)Parameter1;
|
||||||
|
if (OpenParameters->lpFormat->nSamplesPerSec > 100000)
|
||||||
|
OpenParameters->lpFormat->nSamplesPerSec = 100000;
|
||||||
|
if (OpenParameters->lpFormat->nSamplesPerSec < 5000)
|
||||||
|
OpenParameters->lpFormat->nSamplesPerSec = 5000;
|
||||||
|
|
||||||
Result = MmeOpenDevice(WAVE_IN_DEVICE_TYPE,
|
Result = MmeOpenDevice(WAVE_IN_DEVICE_TYPE,
|
||||||
DeviceId,
|
DeviceId,
|
||||||
(LPWAVEOPENDESC) Parameter1,
|
(LPWAVEOPENDESC) Parameter1,
|
||||||
|
|
Loading…
Reference in a new issue