[svn-commits] tzafrir: branch 1.4 r3708 - in /branches/1.4: zaptel-base.c zaptel.h zconfig.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jan 22 11:11:08 CST 2008


Author: tzafrir
Date: Sun Jan 20 05:52:37 2008
New Revision: 3708

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3708
Log:
Add zconfig build time option OPTIMIZE_CHANMUTE. Disabled by default.

When enabled, a zaptel channel will have an extra boolean flag:
chanmute. If true, Zaptel needs not waste CPU cycles for copying data
for this channel.

If you do not enable the option, this commit should have no effect.

Modified:
    branches/1.4/zaptel-base.c
    branches/1.4/zaptel.h
    branches/1.4/zconfig.h

Change Statistics:
 0 files changed

Modified: branches/1.4/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel-base.c?view=diff&rev=3708&r1=3707&r2=3708
==============================================================================
--- branches/1.4/zaptel-base.c (original)
+++ branches/1.4/zaptel-base.c Sun Jan 20 05:52:37 2008
@@ -608,6 +608,11 @@
 				if ((chans[x]->flags & ZT_FLAG_OPEN)) {
 					len += sprintf(page + len, "(In use) ");
 				}
+#ifdef	OPTIMIZE_CHANMUTE
+				if ((chans[x]->chanmute)) {
+					len += sprintf(page + len, "(no pcm) ");
+				}
+#endif
 				len += sprintf(page + len, "\n");
 			}
 			if (len <= off) { /* If everything printed so far is before beginning of request */
@@ -6860,6 +6865,10 @@
 {
 	unsigned char silly[ZT_CHUNKSIZE];
 	/* Called with chan->lock locked */
+#ifdef	OPTIMIZE_CHANMUTE
+	if(likely(chan->chanmute))
+		return;
+#endif
 	if (!buf)
 		buf = silly;
 	__zt_getbuf_chunk(chan, buf);
@@ -6878,6 +6887,10 @@
 static inline void __zt_real_transmit(struct zt_chan *chan)
 {
 	/* Called with chan->lock held */
+#ifdef	OPTIMIZE_CHANMUTE
+	if(likely(chan->chanmute))
+		return;
+#endif
 	if (chan->confmode) {
 		/* Pull queued data off the conference */
 		__buf_pull(&chan->confout, chan->writechunk, chan, "zt_real_transmit");
@@ -6937,6 +6950,10 @@
 	/* Receive chunk of audio -- called with chan->lock held */
 	unsigned char waste[ZT_CHUNKSIZE];
 
+#ifdef	OPTIMIZE_CHANMUTE
+	if(likely(chan->chanmute))
+		return;
+#endif
 	if (!buf) {
 		memset(waste, ZT_LIN2X(0, chan), sizeof(waste));
 		buf = waste;
@@ -6956,6 +6973,10 @@
 static inline void __zt_real_receive(struct zt_chan *chan)
 {
 	/* Called with chan->lock held */
+#ifdef	OPTIMIZE_CHANMUTE
+	if(likely(chan->chanmute))
+		return;
+#endif
 	if (chan->confmode) {
 		/* Load into queue if we have space */
 		__buf_push(&chan->confin, chan->readchunk, "zt_real_receive");

Modified: branches/1.4/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.h?view=diff&rev=3708&r1=3707&r2=3708
==============================================================================
--- branches/1.4/zaptel.h (original)
+++ branches/1.4/zaptel.h Sun Jan 20 05:52:37 2008
@@ -1451,6 +1451,9 @@
 
 	int deflaw;		/* 1 = mulaw, 2=alaw, 0=undefined */
 	short *xlaw;
+#ifdef	OPTIMIZE_CHANMUTE
+	int chanmute;		/*!< no need for PCM data */
+#endif
 #ifdef CONFIG_CALC_XLAW
 	unsigned char (*lineartoxlaw)(short a);
 #else

Modified: branches/1.4/zconfig.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/zconfig.h?view=diff&rev=3708&r1=3707&r2=3708
==============================================================================
--- branches/1.4/zconfig.h (original)
+++ branches/1.4/zconfig.h Sun Jan 20 05:52:37 2008
@@ -189,4 +189,9 @@
  */
 #define ZAPTEL_SYNC_TICK
 
+/*
+ * Skip processing PCM if low-level driver won't use it anyway
+ */
+/* #define	OPTIMIZE_CHANMUTE */
+
 #endif




More information about the svn-commits mailing list