mirror of
https://github.com/reactos/wine.git
synced 2025-01-27 06:53:49 +00:00
Handle errors for IDsDriver_GetPosition.
Report DSERR_UNINITIALIZED on non-opened WineOSS audio device.
This commit is contained in:
parent
247a94f688
commit
eba8cee584
@ -1295,10 +1295,14 @@ static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER iface) {
|
|||||||
static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(
|
static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(
|
||||||
LPDIRECTSOUNDBUFFER iface,LPDWORD playpos,LPDWORD writepos
|
LPDIRECTSOUNDBUFFER iface,LPDWORD playpos,LPDWORD writepos
|
||||||
) {
|
) {
|
||||||
|
HRESULT hres;
|
||||||
ICOM_THIS(IDirectSoundBufferImpl,iface);
|
ICOM_THIS(IDirectSoundBufferImpl,iface);
|
||||||
TRACE("(%p,%p,%p)\n",This,playpos,writepos);
|
TRACE("(%p,%p,%p)\n",This,playpos,writepos);
|
||||||
if (This->hwbuf) {
|
if (This->hwbuf) {
|
||||||
IDsDriverBuffer_GetPosition(This->hwbuf, playpos, writepos);
|
hres=IDsDriverBuffer_GetPosition(This->hwbuf,playpos,writepos);
|
||||||
|
if (hres)
|
||||||
|
return hres;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (This->dsbd.dwFlags & DSBCAPS_PRIMARYBUFFER) {
|
else if (This->dsbd.dwFlags & DSBCAPS_PRIMARYBUFFER) {
|
||||||
if (playpos && (This->dsbd.dwFlags & DSBCAPS_GETCURRENTPOSITION2)) {
|
if (playpos && (This->dsbd.dwFlags & DSBCAPS_GETCURRENTPOSITION2)) {
|
||||||
@ -2690,6 +2694,7 @@ static void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw
|
|||||||
DWORD len;
|
DWORD len;
|
||||||
int nfiller;
|
int nfiller;
|
||||||
BOOL forced;
|
BOOL forced;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
if (!dsound || !primarybuf) {
|
if (!dsound || !primarybuf) {
|
||||||
ERR("dsound died without killing us?\n");
|
ERR("dsound died without killing us?\n");
|
||||||
@ -2716,7 +2721,11 @@ static void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw
|
|||||||
if (dsound->priolevel != DSSCL_WRITEPRIMARY) {
|
if (dsound->priolevel != DSSCL_WRITEPRIMARY) {
|
||||||
BOOL paused = ((primarybuf->state == STATE_STOPPED) || (primarybuf->state == STATE_STARTING));
|
BOOL paused = ((primarybuf->state == STATE_STOPPED) || (primarybuf->state == STATE_STARTING));
|
||||||
DWORD playpos, writepos, inq, maxq, mixq, frag;
|
DWORD playpos, writepos, inq, maxq, mixq, frag;
|
||||||
IDsDriverBuffer_GetPosition(primarybuf->hwbuf, &playpos, &writepos);
|
hres = IDsDriverBuffer_GetPosition(primarybuf->hwbuf, &playpos, &writepos);
|
||||||
|
if (hres) {
|
||||||
|
LeaveCriticalSection(&(dsound->lock));
|
||||||
|
return;
|
||||||
|
}
|
||||||
/* Well, we *could* do Just-In-Time mixing using the writepos,
|
/* Well, we *could* do Just-In-Time mixing using the writepos,
|
||||||
* but that's a little bit ambitious and unnecessary... */
|
* but that's a little bit ambitious and unnecessary... */
|
||||||
/* rather add our safety margin to the writepos, if we're playing */
|
/* rather add our safety margin to the writepos, if we're playing */
|
||||||
@ -2776,7 +2785,12 @@ static void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw
|
|||||||
}
|
}
|
||||||
/* the Stop is supposed to reset play position to beginning of buffer */
|
/* the Stop is supposed to reset play position to beginning of buffer */
|
||||||
/* unfortunately, OSS is not able to do so, so get current pointer */
|
/* unfortunately, OSS is not able to do so, so get current pointer */
|
||||||
IDsDriverBuffer_GetPosition(primarybuf->hwbuf, &playpos, NULL);
|
hres = IDsDriverBuffer_GetPosition(primarybuf->hwbuf, &playpos, NULL);
|
||||||
|
if (hres) {
|
||||||
|
LeaveCriticalSection(&(dsound->lock));
|
||||||
|
LeaveCriticalSection(&(primarybuf->lock));
|
||||||
|
return;
|
||||||
|
}
|
||||||
writepos = playpos;
|
writepos = playpos;
|
||||||
primarybuf->playpos = playpos;
|
primarybuf->playpos = playpos;
|
||||||
primarybuf->mixpos = playpos;
|
primarybuf->mixpos = playpos;
|
||||||
|
@ -1412,6 +1412,10 @@ static HRESULT WINAPI IDsDriverBufferImpl_GetPosition(PIDSDRIVERBUFFER iface,
|
|||||||
DWORD ptr;
|
DWORD ptr;
|
||||||
|
|
||||||
TRACE("(%p)\n",iface);
|
TRACE("(%p)\n",iface);
|
||||||
|
if (WOutDev[This->drv->wDevID].unixdev == -1) {
|
||||||
|
ERR("device not open, but accessing?\n");
|
||||||
|
return DSERR_UNINITIALIZED;
|
||||||
|
}
|
||||||
if (ioctl(WOutDev[This->drv->wDevID].unixdev, SNDCTL_DSP_GETOPTR, &info) < 0) {
|
if (ioctl(WOutDev[This->drv->wDevID].unixdev, SNDCTL_DSP_GETOPTR, &info) < 0) {
|
||||||
ERR("ioctl failed (%d)\n", errno);
|
ERR("ioctl failed (%d)\n", errno);
|
||||||
return DSERR_GENERIC;
|
return DSERR_GENERIC;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user