@@ -347,8 +347,6 @@ SoundDeviceError SoundDevicePortAudio::open(bool isClkRefDevice, int syncBuffers
347
347
qDebug () << " PortAudio: Started stream successfully" ;
348
348
}
349
349
350
- m_clkRefTimer.start ();
351
-
352
350
// Get the actual details of the stream & update Mixxx's data
353
351
const PaStreamInfo* streamDetails = Pa_GetStreamInfo (pStream);
354
352
m_dSampleRate = streamDetails->sampleRate ;
@@ -363,6 +361,7 @@ SoundDeviceError SoundDevicePortAudio::open(bool isClkRefDevice, int syncBuffers
363
361
ControlObject::set (ConfigKey (" [Master]" , " samplerate" ), m_dSampleRate);
364
362
ControlObject::set (ConfigKey (" [Master]" , " audio_buffer_size" ), bufferMSec);
365
363
m_invalidTimeInfoCount = 0 ;
364
+ m_clkRefTimer.start ();
366
365
}
367
366
m_pStream = pStream;
368
367
return SOUNDDEVICE_ERROR_OK;
@@ -1005,7 +1004,8 @@ void SoundDevicePortAudio::updateCallbackEntryToDacTime(
1005
1004
(timeSinceLastCbSecs < bufferSizeSec * 2 &&
1006
1005
fabs (diff) / bufferSizeSec > 0.1 )) {
1007
1006
// Fall back to CPU timing:
1008
- // If timeSinceLastCbSecs from a CPU timer is reasonable (no underflow)
1007
+ // If timeSinceLastCbSecs from a CPU timer is reasonable (no underflow),
1008
+ // the callbackEntrytoDacSecs time is not in the past
1009
1009
// and we have more than 10 % difference to the timing provided by Portaudio
1010
1010
// we do not trust the Portaudio timing.
1011
1011
// (A difference up to ~ 5 % is normal)
0 commit comments