Commit 639db3ef authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Stop wavemap lookup if a device isn't functional (spotted by Lionel

Ulmer).
parent cadffabd
......@@ -185,8 +185,11 @@ static DWORD wodOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
/* try some ACM stuff */
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
if (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT) == MMSYSERR_NOERROR) \
{wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found;}
switch (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
case MMSYSERR_NOERROR: wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
case WAVERR_BADFORMAT: break; \
default: goto error; \
}
/* Our resampling algorithm is quite primitive so first try
* to just change the bit depth and number of channels
......@@ -248,6 +251,9 @@ found:
*lpdwUser = (DWORD)wom;
}
return MMSYSERR_NOERROR;
error:
HeapFree(GetProcessHeap(), 0, wom);
return MMSYSERR_ERROR;
}
static DWORD wodClose(WAVEMAPDATA* wom)
......@@ -627,8 +633,11 @@ static DWORD widOpen(LPDWORD lpdwUser, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
/* try some ACM stuff */
#define TRY(sps,bps) wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
if (widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT) == MMSYSERR_NOERROR) \
{wim->avgSpeedInner = wfx.nAvgBytesPerSec; goto found;}
switch (widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
case MMSYSERR_NOERROR: wim->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
case WAVERR_BADFORMAT: break; \
default: goto error; \
}
for (i = ndlo; i < ndhi; i++) {
wfx.nSamplesPerSec=lpDesc->lpFormat->nSamplesPerSec;
......@@ -689,6 +698,9 @@ found:
}
TRACE("Ok (stream=%08lx)\n", (DWORD)wim->hAcmStream);
return MMSYSERR_NOERROR;
error:
HeapFree(GetProcessHeap(), 0, wim);
return MMSYSERR_ERROR;
}
static DWORD widClose(WAVEMAPDATA* wim)
......
......@@ -284,7 +284,7 @@ static DWORD OSS_RawOpenDevice(OSS_DEVICE* ossdev, int strict_format)
*/
if (rc != 0 && errno != EINVAL) {
ERR("ioctl(%s, SNDCTL_DSP_SETDUPLEX) failed (%s)\n", ossdev->dev_name, strerror(errno));
goto error;
goto error2;
}
}
......@@ -292,7 +292,7 @@ static DWORD OSS_RawOpenDevice(OSS_DEVICE* ossdev, int strict_format)
rc = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &ossdev->audio_fragment);
if (rc != 0) {
ERR("ioctl(%s, SNDCTL_DSP_SETFRAGMENT) failed (%s)\n", ossdev->dev_name, strerror(errno));
goto error;
goto error2;
}
}
......@@ -350,6 +350,9 @@ static DWORD OSS_RawOpenDevice(OSS_DEVICE* ossdev, int strict_format)
error:
close(fd);
return WAVERR_BADFORMAT;
error2:
close(fd);
return MMSYSERR_ERROR;
}
/******************************************************************
......@@ -1455,7 +1458,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
audio_buf_info info;
DWORD ret;
TRACE("(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
TRACE("(%u, %p[cb=%08lx], %08lX);\n", wDevID, lpDesc, lpDesc->dwCallback, dwFlags);
if (lpDesc == NULL) {
WARN("Invalid Parameter !\n");
return MMSYSERR_INVALPARAM;
......
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