Fix erroneous getStreamTime() results in some cases.
authorCarl Hetherington <cth@carlh.net>
Mon, 15 Apr 2019 11:30:52 +0000 (12:30 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Apr 2019 11:30:52 +0000 (12:30 +0100)
commitfc3516152671131316485619639433902fbadc40
tree333d4369cc5244589da3c9b8e553159701b52605
parent27439e00b734fba8f2df383e89a5f2dd2949f5b2
Fix erroneous getStreamTime() results in some cases.

Without this, if HAVE_GETTIMEOFDAY is defined getStreamTime() can return
a wrong value in the following case:

- start stream
- stop stream
- start stream
- call getStreamTime() immediately

In this case tickStreamTime() will not have been called since the
stream was restarted, hence lastTickTimestamp will refer to the
previous run of the stream.  getStreamTime() will therefore extrapolate
wrongly from stream._streamTime.  This patch only uses lastTickTimestamp
when it is valid.
RtAudio.cpp
RtAudio.h