[asterisk-commits] dlee: branch dlee/record-controls r395319 - /team/dlee/record-controls/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 24 15:34:06 CDT 2013


Author: dlee
Date: Wed Jul 24 15:34:05 2013
New Revision: 395319

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395319
Log:
Cleanup

Modified:
    team/dlee/record-controls/main/app.c

Modified: team/dlee/record-controls/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/main/app.c?view=diff&rev=395319&r1=395318&r2=395319
==============================================================================
--- team/dlee/record-controls/main/app.c (original)
+++ team/dlee/record-controls/main/app.c Wed Jul 24 15:34:05 2013
@@ -1144,6 +1144,15 @@
 	return d;
 }
 
+/*!
+ * \brief Construct a silence frame of the same duration of \a orig.
+ *
+ * The \a orig frame must be \ref AST_FORMAT_SLINEAR.
+ *
+ * \param orig Frame to base silence.
+ * \return New frame of silence; free with ast_frfree().
+ * \return \c NULL on error.
+ */
 static struct ast_frame *make_silence(const struct ast_frame *orig)
 {
 	struct ast_frame *silence;
@@ -1188,8 +1197,21 @@
 	return silence;
 }
 
+/*!
+ * \brief Sets a channel's read format to \ref AST_FORMAT_SLINEAR, recording
+ * its original format.
+ *
+ * \param chan Channel to modify.
+ * \param[out] orig_format Output variable to store channel's original read
+ *                         format.
+ * \return 0 on success.
+ * \return -1 on error.
+ */
 static int set_read_to_slin(struct ast_channel *chan, struct ast_format *orig_format)
 {
+	if (!chan || !orig_format) {
+		return -1;
+	}
 	ast_format_copy(orig_format, ast_channel_readformat(chan));
 	return ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR);
 }
@@ -1233,7 +1255,6 @@
 	int totalsilence = 0;
 	int dspsilence = 0;
 	int olddspsilence = 0;
-	int pausedsilence = 0;
 	struct ast_format rfmt;
 	struct ast_silence_generator *silgen = NULL;
 	char prependfile[PATH_MAX];
@@ -1342,14 +1363,16 @@
 	}
 
 	if (x == fmtcnt) {
-		/* Loop forever, writing the packets we read to the writer(s), until
-		   we read a digit or get a hangup */
+		/* Loop, writing the packets we read to the writer(s), until
+		 * we have reason to stop. */
 		struct ast_frame *f;
 		int paused = 0;
 		int muted = 0;
 		int running = 1;
 		time_t pause_start = 0;
 		int paused_secs = 0;
+		int pausedsilence = 0;
+
 		while (running) {
 			if (!(res = ast_waitfor(chan, 2000))) {
 				ast_debug(1, "One waitfor failed, trying another\n");




More information about the asterisk-commits mailing list