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 19:48:45 +0000 (20:48 +0100)
commite46da8995672eda8500a8567c3edcdeef9b44e3d
treefbf5b73b790a3bbae182379c292f28d6a46d5eca
parent8b274949714bc46e0a780c73c921526762a24a56
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