Mercurial > hg > beaglert
diff core/ReceiveAudioThread.cpp @ 133:04b1678614c9 scope-refactoring
Using moving average for clock detection during synchronization seems to be working better but audio gets worse and worse
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Thu, 27 Aug 2015 03:33:32 +0100 |
parents | e24c531220ee |
children | e77e2e712fbc |
line wrap: on
line diff
--- a/core/ReceiveAudioThread.cpp Thu Aug 27 01:42:04 2015 +0100 +++ b/core/ReceiveAudioThread.cpp Thu Aug 27 03:33:32 2015 +0100 @@ -202,11 +202,18 @@ return -2; if(isListening()==false) return -1; - if(writePointer<0){ //if writePointer has not been initalized yet ... + static int numCalls=0; + if(writePointer<0 || (numCalls&16383)==0){ //if writePointer has not been initalized yet ... +#ifdef USE_JUCE +#else //debug + rt_printf("reinit the writePointer, readPointer: %f;\n",readPointer); + readPointer=0; +#endif /* USE_JUCE */ writePointer=2*length; // do it, so that it starts writing at a safety margin from where we write. // This will help keeping them in sync. //TODO: handle what happens when the remote stream is interrupted and then restarted } + numCalls++; if(length>lastValidPointer) { //not enough samples available, we fill the buffer with what is available, but the destination buffer will not be filled completely //at this very moment the other thread might be writing at most one payload into the buffer.