Maarten Lankhorst : winealsa.drv: Small capture fixes.
Alexandre Julliard
julliard at winehq.org
Mon Oct 5 09:54:27 CDT 2009
Module: wine
Branch: master
Commit: b0e45368d7385c77622abe5d86c1772a2866aa29
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b0e45368d7385c77622abe5d86c1772a2866aa29
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Tue Sep 22 13:49:27 2009 +0200
winealsa.drv: Small capture fixes.
Deadlock, off-by-one and forgetting to declare that we want MMAP
access, so accelerated mode wouldn't work at all but fail silently.
---
dlls/winealsa.drv/dscapture.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/winealsa.drv/dscapture.c b/dlls/winealsa.drv/dscapture.c
index 304a5eb..a15c369 100644
--- a/dlls/winealsa.drv/dscapture.c
+++ b/dlls/winealsa.drv/dscapture.c
@@ -134,7 +134,8 @@ static void CALLBACK Capture_Notify(UINT timerID, UINT msg, DWORD_PTR dwUser, DW
PIDSCDRIVERBUFFER iface = (PIDSCDRIVERBUFFER)This;
/* **** */
- EnterCriticalSection(&This->pcm_crst);
+ /* Don't deadlock since there is a critical section can be held by the timer api itself while running this code */
+ if (!TryEnterCriticalSection(&This->pcm_crst)) return;
IDsDriverBuffer_GetPosition(iface, &playpos, NULL);
last_playpos = This->notify->playpos;
@@ -555,7 +556,7 @@ static HRESULT WINAPI IDsCaptureDriverBufferImpl_Lock(PIDSCDRIVERBUFFER iface, L
if (ppvAudio1)
*ppvAudio1 = (LPBYTE)This->presented_buffer + dwWritePosition;
- if (dwWritePosition + dwWriteLen < This->mmap_buflen_bytes) {
+ if (dwWritePosition + dwWriteLen <= This->mmap_buflen_bytes) {
if (pdwLen1)
*pdwLen1 = dwWriteLen;
if (ppvAudio2)
@@ -631,6 +632,9 @@ static HRESULT WINAPI IDsCaptureDriverBufferImpl_SetFormat(PIDSCDRIVERBUFFER ifa
/* Set some defaults */
snd_pcm_hw_params_any(pcm, hw_params);
+ err = snd_pcm_hw_params_set_access (pcm, hw_params, SND_PCM_ACCESS_MMAP_INTERLEAVED);
+ if (err < 0) goto err;
+
err = snd_pcm_hw_params_set_channels(pcm, hw_params, pwfx->nChannels);
if (err < 0) { WARN("Could not set channels to %d\n", pwfx->nChannels); goto err; }
More information about the wine-cvs
mailing list