[asterisk-commits] file: trunk r113009 - in /trunk: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 7 09:54:43 CDT 2008


Author: file
Date: Mon Apr  7 09:54:42 2008
New Revision: 113009

URL: http://svn.digium.com/view/asterisk?view=rev&rev=113009
Log:
Put my slinfactory changes back in.

Modified:
    trunk/include/asterisk/slinfactory.h
    trunk/main/slinfactory.c

Modified: trunk/include/asterisk/slinfactory.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/slinfactory.h?view=diff&rev=113009&r1=113008&r2=113009
==============================================================================
--- trunk/include/asterisk/slinfactory.h (original)
+++ trunk/include/asterisk/slinfactory.h Mon Apr  7 09:54:42 2008
@@ -28,10 +28,12 @@
 extern "C" {
 #endif
 
+#define AST_SLINFACTORY_MAX_HOLD 1280
+
 struct ast_slinfactory {
 	AST_LIST_HEAD_NOLOCK(, ast_frame) queue; /*!< A list of unaltered frames */
 	struct ast_trans_pvt *trans;             /*!< Translation path that converts fed frames into signed linear */
-	short hold[1280];                        /*!< Hold for audio that no longer belongs to a frame (ie: if only some samples were taken from a frame) */
+	short hold[AST_SLINFACTORY_MAX_HOLD];    /*!< Hold for audio that no longer belongs to a frame (ie: if only some samples were taken from a frame) */
 	short *offset;                           /*!< Offset into the hold where audio begins */
 	size_t holdlen;                          /*!< Number of samples currently in the hold */
 	unsigned int size;                       /*!< Number of samples currently in the factory */

Modified: trunk/main/slinfactory.c
URL: http://svn.digium.com/view/asterisk/trunk/main/slinfactory.c?view=diff&rev=113009&r1=113008&r2=113009
==============================================================================
--- trunk/main/slinfactory.c (original)
+++ trunk/main/slinfactory.c Mon Apr  7 09:54:42 2008
@@ -172,6 +172,9 @@
 				memcpy(offset, frame_data, ineed * sizeof(*offset));
 				sofar += ineed;
 				frame_data += ineed;
+				if (remain > (AST_SLINFACTORY_MAX_HOLD - sf->holdlen)) {
+					remain = AST_SLINFACTORY_MAX_HOLD - sf->holdlen;
+				}
 				memcpy(sf->hold, frame_data, remain * sizeof(*offset));
 				sf->holdlen = remain;
 			}




More information about the asterisk-commits mailing list