[svn-commits] tzafrir: branch 1.4 r4408 - in /branches/1.4: ./ kernel/xpp/xbus-pcm.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 10 03:03:56 CDT 2008


Author: tzafrir
Date: Thu Jul 10 03:03:56 2008
New Revision: 4408

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4408
Log:
PCM: A bugfix that was reintroduced in r4353:
After this change, the echo-canceler buffers were not cleared
in some cases. As a result when one FXS is put ONHOOK, the other side 
could hear noise for a second or two until full disconnect is done.

Merged revisions 4407 via svnmerge from 
http://svn.digium.com/svn/zaptel/branches/1.2

Modified:
    branches/1.4/   (props changed)
    branches/1.4/kernel/xpp/xbus-pcm.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/kernel/xpp/xbus-pcm.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/xpp/xbus-pcm.c?view=diff&rev=4408&r1=4407&r2=4408
==============================================================================
--- branches/1.4/kernel/xpp/xbus-pcm.c (original)
+++ branches/1.4/kernel/xpp/xbus-pcm.c Thu Jul 10 03:03:56 2008
@@ -865,23 +865,30 @@
 	pcm = RPACKET_FIELD(pack, GLOBAL, PCM_READ, pcm);
 	pcm_mask = RPACKET_FIELD(pack, GLOBAL, PCM_READ, lines);
 	spin_lock_irqsave(&xpd->lock, flags);
-	pcm_mute = xpd->mute_dtmf | xpd->silence_pcm;
+	/*
+	 * Calculate the channels we want to mute
+	 */
+	pcm_mute = ~xpd->wanted_pcm_mask;
+	pcm_mute |= xpd->mute_dtmf | xpd->silence_pcm;
 	if(!SPAN_REGISTERED(xpd))
 		goto out;
 	for (i = 0; i < xpd->channels; i++) {
 		volatile u_char	*r = xpd->span.chans[i].readchunk;
 		bool		got_data = IS_SET(pcm_mask, i);
 
-		if(IS_SET(xpd->wanted_pcm_mask, i)) {
-			/* Must fill zaptel buffers */
-			if(got_data && !IS_SET(pcm_mute, i)) {
-				/* We have and want real data */
-				// memset((u_char *)r, 0x5A, ZT_CHUNKSIZE);	// DEBUG
-				// fill_beep((u_char *)r, 1, 1);	// DEBUG: BEEP
-				memcpy((u_char *)r, pcm, ZT_CHUNKSIZE);
-			} else {
-				/* Inject SILENCE */
-				memset((u_char *)r, 0x7F, ZT_CHUNKSIZE);
+		if(got_data && !IS_SET(pcm_mute, i)) {
+			/* We have and want real data */
+			// memset((u_char *)r, 0x5A, ZT_CHUNKSIZE);	// DEBUG
+			// fill_beep((u_char *)r, 1, 1);	// DEBUG: BEEP
+			memcpy((u_char *)r, pcm, ZT_CHUNKSIZE);
+		} else if(IS_SET(xpd->wanted_pcm_mask | xpd->silence_pcm, i)) {
+			/* Inject SILENCE */
+			memset((u_char *)r, 0x7F, ZT_CHUNKSIZE);
+			if(IS_SET(xpd->silence_pcm, i)) {
+				/*
+				 * This will clear the EC buffers until next tick
+				 * So we don't have noise residues from the past.
+				 */
 				memset(xpd->ec_chunk2[i], 0x7F, ZT_CHUNKSIZE);
 				memset(xpd->ec_chunk1[i], 0x7F, ZT_CHUNKSIZE);
 			}




More information about the svn-commits mailing list