]> Repos - portaudio/commitdiff
Fix latency calculation in PA ALSA svn/1415
authoraknudsen <aknudsen@0f58301d-fd10-0410-b4af-bbb618454e57>
Wed, 3 Jun 2009 18:57:56 +0000 (18:57 +0000)
committeraknudsen <aknudsen@0f58301d-fd10-0410-b4af-bbb618454e57>
Wed, 3 Jun 2009 18:57:56 +0000 (18:57 +0000)
src/hostapi/alsa/pa_linux_alsa.c

index 18e246e613c87daaf390e77a932c2a75a4227079..cb80702fd044dadce2f0900cda2558b58301e1c7 100644 (file)
@@ -2003,11 +2003,11 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
 
     /* Ok, buffer processor is initialized, now we can deduce it's latency */
     if( numInputChannels > 0 )
-        stream->streamRepresentation.streamInfo.inputLatency = inputLatency + PaUtil_GetBufferProcessorInputLatency(
-                &stream->bufferProcessor );
+        stream->streamRepresentation.streamInfo.inputLatency = inputLatency + (PaTime)(
+                PaUtil_GetBufferProcessorInputLatency( &stream->bufferProcessor ) / sampleRate);
     if( numOutputChannels > 0 )
-        stream->streamRepresentation.streamInfo.outputLatency = outputLatency + PaUtil_GetBufferProcessorOutputLatency(
-                &stream->bufferProcessor );
+        stream->streamRepresentation.streamInfo.outputLatency = outputLatency + (PaTime)(
+                PaUtil_GetBufferProcessorOutputLatency( &stream->bufferProcessor ) / sampleRate);
 
     *s = (PaStream*)stream;