This is a read-only archive of the Mumble forums.

This website archives and makes accessible historical state. It receives no updates or corrections. It is provided only to keep the information accessible as-is, under their old address.

For up-to-date information please refer to the Mumble website and its linked documentation and other resources. For support please refer to one of our other community/support channels.

Jump to content

need help understand the echo cancellation code


Recommended Posts


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);


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!

Link to comment
Share on other sites


  • Create New...