[svn-commits] tzafrir: branch 1.2 r4352 - /branches/1.2/xpp/xbus-pcm.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Jun 15 09:28:58 CDT 2008


Author: tzafrir
Date: Sun Jun 15 09:28:58 2008
New Revision: 4352

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4352
Log:
Muted DTMF PCM (from FXS modules) could "leak" to the next channel.
(From xpp r5796).

Modified:
    branches/1.2/xpp/xbus-pcm.c

Modified: branches/1.2/xpp/xbus-pcm.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/xbus-pcm.c?view=diff&rev=4352&r1=4351&r2=4352
==============================================================================
--- branches/1.2/xpp/xbus-pcm.c (original)
+++ branches/1.2/xpp/xbus-pcm.c Sun Jun 15 09:28:58 2008
@@ -858,34 +858,36 @@
 {
 	byte		*pcm;
 	xpp_line_t	pcm_mask;
+	xpp_line_t	pcm_mute;
 	unsigned long	flags;
 	int		i;
 
 	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;
 	if(!SPAN_REGISTERED(xpd))
 		goto out;
 	for (i = 0; i < xpd->channels; i++) {
 		volatile u_char	*r = xpd->span.chans[i].readchunk;
-
-		if(!IS_SET(xpd->wanted_pcm_mask, i)) {
-			if(IS_SET(xpd->silence_pcm, i)) {
-				memset((u_char *)r, 0x7F, ZT_CHUNKSIZE);	// SILENCE
+		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);
 				memset(xpd->ec_chunk2[i], 0x7F, ZT_CHUNKSIZE);
 				memset(xpd->ec_chunk1[i], 0x7F, ZT_CHUNKSIZE);
 			}
-			continue;
-		}
-		pcm_mask &= ~xpd->mute_dtmf;
-		if(IS_SET(pcm_mask, i)) {
-			// memset((u_char *)r, 0x5A, ZT_CHUNKSIZE);	// DEBUG
-			// fill_beep((u_char *)r, 1, 1);	// DEBUG: BEEP
-			memcpy((u_char *)r, pcm, ZT_CHUNKSIZE);
+		}
+		if(got_data)
 			pcm += ZT_CHUNKSIZE;
-		} else {
-			memset((u_char *)r, 0x7F, ZT_CHUNKSIZE);	// SILENCE
-		}
 	}
 out:
 	XPD_COUNTER(xpd, PCM_READ)++;




More information about the svn-commits mailing list