[svn-commits] wdoekes: trunk r405766 - in /trunk: CHANGES res/res_musiconhold.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jan 17 08:17:09 CST 2014


Author: wdoekes
Date: Fri Jan 17 08:17:04 2014
New Revision: 405766

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=405766
Log:
Enable wide band audio in musiconhold streams.

Review: https://reviewboard.asterisk.org/r/3112/

Modified:
    trunk/CHANGES
    trunk/res/res_musiconhold.c

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=405766&r1=405765&r2=405766
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Fri Jan 17 08:17:04 2014
@@ -44,6 +44,11 @@
      SELECTED    user selected a user from the directory and is routed
      USEREXIT    user pressed '#' from the selection prompt to exit
      FAILED      directory failed in a way that wasn't accounted for. Dang.
+
+MusicOnHold
+--------------------------
+ * MusicOnHold streams (all modes other than "files") now support wide band
+   audio too.
 
 Page
 --------------------------

Modified: trunk/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_musiconhold.c?view=diff&rev=405766&r1=405765&r2=405766
==============================================================================
--- trunk/res/res_musiconhold.c (original)
+++ trunk/res/res_musiconhold.c Fri Jan 17 08:17:04 2014
@@ -704,7 +704,8 @@
 					ast_log(LOG_ERROR, "Failed to acknowledge timer for mp3player\n");
 					return NULL;
 				}
-				res = 320;
+				/* 25 samples per second => 40ms framerate => 320 samples */
+				res = 320; /* 320/40 = 8 samples/ms */
 			} else {
 				ast_log(LOG_WARNING, "poll() failed: %s\n", strerror(errno));
 				res = 0;
@@ -725,8 +726,12 @@
 				ast_log(LOG_NOTICE, "Request to schedule in the past?!?!\n");
 				deadline = tv_tmp;
 			}
-			res = 8 * MOH_MS_INTERVAL;	/* 8 samples per millisecond */
-		}
+			/* 10 samples per second (MOH_MS_INTERVAL) => 100ms framerate => 800 samples */
+			res = 8 * MOH_MS_INTERVAL; /* 800/100 = 8 samples/ms */
+		}
+		/* For non-8000Hz formats, we need to alter the resolution */
+		res = res * ast_format_rate(&class->format) / 8000;
+
 		if ((strncasecmp(class->dir, "http://", 7) && strcasecmp(class->dir, "nodir")) && AST_LIST_EMPTY(&class->members))
 			continue;
 		/* Read mp3 audio */




More information about the svn-commits mailing list