mmdevapi: Unlock buffer in case of ReleaseBuffer error.

This commit is contained in:
Jörg Höhle 2011-09-12 07:12:10 +02:00 committed by Alexandre Julliard
parent 55efce6c9c
commit 8379680095
2 changed files with 4 additions and 2 deletions

View File

@ -2097,8 +2097,9 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
written = alsa_write_best_effort(This->pcm_handle, buffer,
written_frames, This);
if(written < 0){
This->buf_state = NOT_LOCKED;
LeaveCriticalSection(&This->lock);
WARN("write failed: %ld (%s)\n", written, snd_strerror(written));
ERR("write failed: %ld (%s)\n", written, snd_strerror(written));
return E_FAIL;
}

View File

@ -1731,8 +1731,9 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
written_frames * This->fmt->nBlockAlign);
if(w_bytes < 0){
if(errno != EAGAIN){
This->buf_state = NOT_LOCKED;
LeaveCriticalSection(&This->lock);
WARN("write failed: %d (%s)\n", errno, strerror(errno));
ERR("write failed: %d (%s)\n", errno, strerror(errno));
return E_FAIL;
}else /* OSS buffer full */
w_bytes = 0;