[asterisk-commits] rizzo: trunk r48568 - /trunk/include/asterisk/channel.h

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Dec 18 10:44:19 MST 2006


Author: rizzo
Date: Mon Dec 18 11:44:18 2006
New Revision: 48568

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48568
Log:
unbreak the macro used for incrementing the frame counters.

I don't know when the bug was introduced, but with the typical usage

	c->fin = FRAMECOUNT_INC(c->fin)

the frame counters stay to 0.


Modified:
    trunk/include/asterisk/channel.h

Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=48568&r1=48567&r2=48568
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Mon Dec 18 11:44:18 2006
@@ -310,8 +310,21 @@
 struct ast_channel_spy_list;	/*!< \todo Add explanation here */
 struct ast_channel_whisper_buffer;	/*!< \todo Add explanation here */
 
+/*!
+ * The high bit of the frame count is used as a debug marker, so
+ * increments of the counters must be done with care.
+ * Please use c->fin = FRAMECOUNT_INC(c->fin) and the same for c->fout.
+ */
 #define	DEBUGCHAN_FLAG  0x80000000
-#define	FRAMECOUNT_INC(x)	( ((x) & DEBUGCHAN_FLAG) | ((x++) & ~DEBUGCHAN_FLAG) )
+
+/* XXX not ideal to evaluate x twice... */
+#define	FRAMECOUNT_INC(x)	( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) )
+
+/*!
+ * The current value of the debug flags is stored in the two
+ * variables global_fin and global_fout (declared in main/channel.c)
+ */
+extern unsigned long global_fin, global_fout;
 
 enum ast_channel_adsicpe {
 	AST_ADSI_UNKNOWN,



More information about the asterisk-commits mailing list