fixed bug in asio blocking i/o stream initialization which would cause crash (bad ptr). enabled timeout code in read/writestream. patch from sven fischer

This commit is contained in:
rossb 2009-03-13 16:31:28 +00:00
commit e1cf376aa6

View file

@ -2055,7 +2055,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
{
/* Blocking i/o is implemented by running callback mode, using a special blocking i/o callback. */
streamCallback = BlockingIoPaCallback; /* Setup PA to use the ASIO blocking i/o callback. */
userData = &stream; /* The callback user data will be the PA ASIO stream. */
userData = &theAsioStream; /* The callback user data will be the PA ASIO stream. */
PaUtil_InitializeStreamRepresentation( &stream->streamRepresentation,
&asioHostApi->blockingStreamInterface, streamCallback, userData );
}
@ -3470,11 +3470,8 @@ static PaError ReadStream( PaStream *s ,
/* If block processing has stopped, abort! */
if( blockingState->stopFlag ) { return result = paStreamIsStopped; }
/* if a timeout is encountered, continue, perhaps we should give up eventually */
continue;
/* To give up eventually, we may increase the time out
period and return an error if it fails anyway. */
/* retrun result = paTimedOut; */
/* If a timeout is encountered, give up eventually. */
return result = paTimedOut;
}
}
/* Now, the ring buffer contains the required amount of data
@ -3644,11 +3641,9 @@ static PaError WriteStream( PaStream *s ,
/* If block processing has stopped, abort! */
if( blockingState->stopFlag ) { return result = paStreamIsStopped; }
/* if a timeout is encountered, continue, perhaps we should give up eventually */
continue;
/* To give up eventually, we may increase the time out
period and return an error if it fails anyway. */
/* retrun result = paTimedOut; */
/* If a timeout is encountered, give up eventually. */
return result = paTimedOut;
}
}
/* Now, the ring buffer contains the required amount of free