Avoid crash if invalid rate was specified.

This commit is contained in:
Oleg Prokhorov 2003-09-17 22:39:20 +00:00 committed by Alexandre Julliard
parent f2cac81ac5
commit 223a442de1
1 changed files with 10 additions and 1 deletions

View File

@ -1849,8 +1849,13 @@ static HRESULT WINAPI IDsDriverBufferImpl_GetPosition(PIDSDRIVERBUFFER iface,
ICOM_THIS(IDsDriverBufferImpl,iface);
WINE_WAVEOUT * wwo = &(WOutDev[This->drv->wDevID]);
snd_pcm_uframes_t hw_ptr;
snd_pcm_uframes_t period_size = snd_pcm_hw_params_get_period_size(wwo->hw_params, 0);
snd_pcm_uframes_t period_size;
if (wwo->hw_params == NULL) return DSERR_GENERIC;
period_size = snd_pcm_hw_params_get_period_size(wwo->hw_params, 0);
if (wwo->p_handle == NULL) return DSERR_GENERIC;
/** we need to track down buffer underruns */
DSDB_CheckXRUN(This);
@ -1875,6 +1880,8 @@ static HRESULT WINAPI IDsDriverBufferImpl_Play(PIDSDRIVERBUFFER iface, DWORD dwR
TRACE("(%p,%lx,%lx,%lx)\n",iface,dwRes1,dwRes2,dwFlags);
if (wwo->p_handle == NULL) return DSERR_GENERIC;
state = snd_pcm_state(wwo->p_handle);
if ( state == SND_PCM_STATE_SETUP )
{
@ -1899,6 +1906,8 @@ static HRESULT WINAPI IDsDriverBufferImpl_Stop(PIDSDRIVERBUFFER iface)
TRACE("(%p)\n",iface);
if (wwo->p_handle == NULL) return DSERR_GENERIC;
/* ring buffer wrap up detection */
IDsDriverBufferImpl_GetPosition(iface, &play, &write);
if ( play > write)