[svn-commits] tzafrir: branch 1.2 r4407 - /branches/1.2/xpp/xbus-pcm.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Jul 10 02:49:13 CDT 2008
Author: tzafrir
Date: Thu Jul 10 02:49:12 2008
New Revision: 4407
URL: http://svn.digium.com/view/zaptel?view=rev&rev=4407
Log:
PCM: A bugfix that was reintroduced in r4352:
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.
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=4407&r1=4406&r2=4407
==============================================================================
--- branches/1.2/xpp/xbus-pcm.c (original)
+++ branches/1.2/xpp/xbus-pcm.c Thu Jul 10 02:49:12 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