billconan Posted October 10, 2015 Share Posted October 10, 2015 :oops: Hello there,I'm trying to understand the echo cancellation code. but I can't make sense of the following code: QMutexLocker l(&qmEcho); if (qlEchoFrames.isEmpty()) { iJitterSeq = 0; iMinBuffered = 1000; } else { // Compensate for drift between the microphone and the echo source iMinBuffered = qMin(iMinBuffered, qlEchoFrames.count()); if ((iJitterSeq > 100) && (iMinBuffered > 1)) { iJitterSeq = 0; iMinBuffered = 1000; delete [] qlEchoFrames.takeFirst(); } echo = qlEchoFrames.takeFirst(); } I understand that the echo frames and the mic frames can have some offset. we need to somehow realign them. but I just can't understand iJitterSeq and iMinBuffered and why when (iJitterSeq > 100) && (iMinBuffered > 1) the queue needs to be popped?also what do 1000 and 100 mean here? why did we hard code it to 1000?later in the code, iJitterSeq is updated by this line: iJitterSeq = qMin(iJitterSeq + 1,10000U); qlEchoFrames.append(outbuff); this means iJitterSeq should be the size of qlEchoFrames for most of the time (when the size is less than 10000)and this line updates iMinBuffered iMinBuffered = qMin(iMinBuffered, qlEchoFrames.count()); meaning iMinBuffered should be also the size of qlEchoFrames for most of the time (when count is less than 1000)does this mean iMinBuffered == iJitterSeq? then why do we use two variables?Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.