]> Repos - portaudio/commitdiff
wasapi: - fixed occasional bug (affects Windows 7 mostly) which is related to stream...
authordmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 20 Jul 2010 19:01:17 +0000 (19:01 +0000)
committerdmitrykos <dmitrykos@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 20 Jul 2010 19:01:17 +0000 (19:01 +0000)
src/hostapi/wasapi/pa_win_wasapi.c

index 9ca671c087ee7a94573243dd2e59ec4435d2af36..25bd67f1dd27ff80ef1c62ce34ba9410feb49958 100644 (file)
@@ -2089,6 +2089,7 @@ static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSu
 \r
                        // Use Polling interface\r
                        pSub->streamFlags &= ~AUDCLNT_STREAMFLAGS_EVENTCALLBACK;\r
+                       PRINT(("WASAPI: CreateAudioClient: forcing POLL mode\n"));\r
                }\r
        }\r
 #endif\r
@@ -2503,7 +2504,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                // Append buffer latency to interface latency in shared mode (see GetStreamLatency notes)\r
                stream->in.latency_seconds += buffer_latency;\r
 \r
-               PRINT(("WASAPI::OpenStream(input): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->in.framesPerHostCallback, (float)(stream->in.latency_seconds*1000.0f), (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (paWasapi->useWOW64Workaround ? "YES" : "NO")));\r
+               PRINT(("WASAPI::OpenStream(input): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ] mode[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->in.framesPerHostCallback, (float)(stream->in.latency_seconds*1000.0f), (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (paWasapi->useWOW64Workaround ? "YES" : "NO"), (stream->in.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? "EVENT" : "POLL")));\r
        }\r
     else\r
     {\r
@@ -2617,7 +2618,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                // Append buffer latency to interface latency in shared mode (see GetStreamLatency notes)\r
                stream->out.latency_seconds += buffer_latency;\r
 \r
-               PRINT(("WASAPI::OpenStream(output): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->out.framesPerHostCallback, (float)(stream->out.latency_seconds*1000.0f), (stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (paWasapi->useWOW64Workaround ? "YES" : "NO")));\r
+               PRINT(("WASAPI::OpenStream(output): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ] mode[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->out.framesPerHostCallback, (float)(stream->out.latency_seconds*1000.0f), (stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (paWasapi->useWOW64Workaround ? "YES" : "NO"), (stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? "EVENT" : "POLL")));\r
        }\r
     else\r
     {\r
@@ -3884,11 +3885,21 @@ PA_THREAD_FUNC ProcThreadPoll(void *param)
                // when in full-duplex mode as it requires input processing as well\r
                if (!PA_WASAPI__IS_FULLDUPLEX(stream))\r
                {\r
-                       if ((hr = ProcessOutputBuffer(stream, processor, stream->out.framesPerBuffer)) != S_OK)\r
+                       UINT32 frames = 0;\r
+                       if ((hr = PollGetOutputFramesAvailable(stream, &frames)) == S_OK)\r
+            {\r
+                if (frames != 0)\r
+                {\r
+                    if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)\r
+                    {\r
+                        LogHostError(hr); // not fatal, just log\r
+                    }\r
+                }\r
+            }\r
+            else\r
                        {\r
-                               LogHostError(hr);\r
-                               goto thread_error;\r
-                       }\r
+                               LogHostError(hr); // not fatal, just log\r
+                       }            \r
                }\r
 \r
                // Start\r