<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8116">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_confbridge: Update dsp_silence_threshold and dsp_talking_threshold docs.<br><br>The dsp_talking_threshold does not represent time in milliseconds. It<br>represents the average magnitude per sample in the audio packets. This is<br>what the DSP uses to determine if a packet is silence or talking/noise.<br><br>Change-Id: If6f939c100eb92a5ac6c21236559018eeaf58443<br>---<br>M apps/confbridge/conf_config_parser.c<br>M apps/confbridge/include/confbridge.h<br>M bridges/bridge_softmix.c<br>M configs/samples/confbridge.conf.sample<br>M include/asterisk/bridge_technology.h<br>M include/asterisk/dsp.h<br>M main/dsp.c<br>7 files changed, 151 insertions(+), 110 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c<br>index 99eea0a..71da802 100644<br>--- a/apps/confbridge/conf_config_parser.c<br>+++ b/apps/confbridge/conf_config_parser.c<br>@@ -144,72 +144,66 @@<br> </para></description><br> </configOption><br> <configOption name="dsp_silence_threshold"><br>- <synopsis>The number of milliseconds of detected silence necessary to trigger silence detection</synopsis><br>- <description><para><br>- The time in milliseconds of sound falling within the what<br>- the dsp has established as baseline silence before a user<br>- is considered be silent. This value affects several<br>- operations and should not be changed unless the impact<br>- on call quality is fully understood.</para><br>- <para>What this value affects internally:</para><br>- <para><br>- 1. When talk detection AMI events are enabled, this value<br>+ <synopsis>The number of milliseconds of silence necessary to declare talking stopped.</synopsis><br>+ <description><br>+ <para>The time in milliseconds of sound falling below the<br>+ <replaceable>dsp_talking_threshold</replaceable> option when<br>+ a user is considered to stop talking. This value affects several<br>+ operations and should not be changed unless the impact on call<br>+ quality is fully understood.<br>+ </para><br>+ <para>What this value affects internally:<br>+ </para><br>+ <para>1. When talk detection AMI events are enabled, this value<br> determines when the user has stopped talking after a<br> period of talking. If this value is set too low<br> AMI events indicating the user has stopped talking<br> may get falsely sent out when the user briefly pauses<br> during mid sentence.<br>- </para><br>- <para><br>- 2. The <replaceable>drop_silence</replaceable> option depends on this value to<br>- determine when the user's audio should begin to be<br>- dropped from the conference bridge after the user<br>+ </para><br>+ <para>2. The <replaceable>drop_silence</replaceable> option<br>+ depends on this value to determine when the user's audio should<br>+ begin to be dropped from the conference bridge after the user<br> stops talking. If this value is set too low the user's<br>- audio stream may sound choppy to the other participants.<br>- This is caused by the user transitioning constantly from<br>- silence to talking during mid sentence.<br>- </para><br>- <para><br>- The best way to approach this option is to set it slightly above<br>- the maximum amount of ms of silence a user may generate during<br>- natural speech.<br>- </para><br>- <para>By default this value is 2500ms. Valid values are 1 through 2^31.</para><br>+ audio stream may sound choppy to the other participants. This<br>+ is caused by the user transitioning constantly from silence to<br>+ talking during mid sentence.<br>+ </para><br>+ <para>The best way to approach this option is to set it slightly<br>+ above the maximum amount of milliseconds of silence a user may<br>+ generate during natural speech.<br>+ </para><br>+ <para>Valid values are 1 through 2^31.</para><br> </description><br> </configOption><br> <configOption name="dsp_talking_threshold"><br>- <synopsis>The number of milliseconds of detected non-silence necessary to triger talk detection</synopsis><br>- <description><para><br>- The time in milliseconds of sound above what the dsp has<br>- established as base line silence for a user before a user<br>- is considered to be talking. This value affects several<br>- operations and should not be changed unless the impact on<br>- call quality is fully understood.</para><br>- <para><br>- What this value affects internally:<br>+ <synopsis>Average magnitude threshold to determine talking.</synopsis><br>+ <description><br>+ <para>The minimum average magnitude per sample in a frame<br>+ for the DSP to consider talking/noise present. A value below<br>+ this level is considered silence. This value affects several<br>+ operations and should not be changed unless the impact on call<br>+ quality is fully understood.<br> </para><br>- <para><br>- 1. Audio is only mixed out of a user's incoming audio stream<br>- if talking is detected. If this value is set too<br>- loose the user will hear themselves briefly each<br>- time they begin talking until the dsp has time to<br>- establish that they are in fact talking.<br>+ <para>What this value affects internally:<br> </para><br>- <para><br>- 2. When talk detection AMI events are enabled, this value<br>+ <para>1. Audio is only mixed out of a user's incoming audio<br>+ stream if talking is detected. If this value is set too<br>+ high the user will hear himself talking.<br>+ </para><br>+ <para>2. When talk detection AMI events are enabled, this value<br> determines when talking has begun which results in<br>- an AMI event to fire. If this value is set too tight<br>+ an AMI event to fire. If this value is set too low<br> AMI events may be falsely triggered by variants in<br> room noise.<br> </para><br>- <para><br>- 3. The <replaceable>drop_silence</replaceable> option depends on this value to determine<br>- when the user's audio should be mixed into the bridge<br>- after periods of silence. If this value is too loose<br>- the beginning of a user's speech will get cut off as they<br>- transition from silence to talking.<br>+ <para>3. The <replaceable>drop_silence</replaceable> option<br>+ depends on this value to determine when the user's audio should<br>+ be mixed into the bridge after periods of silence. If this value<br>+ is too high the user's speech will get discarded as they will<br>+ be considered silent.<br> </para><br>- <para>By default this value is 160 ms. Valid values are 1 through 2^31</para><br>+ <para>Valid values are 1 through 2^15.</para><br> </description><br> </configOption><br> <configOption name="jitterbuffer"><br>@@ -1479,7 +1473,7 @@<br> "enabled" : "disabled");<br> ast_cli(a->fd,"Silence Threshold: %ums\n",<br> u_profile.silence_threshold);<br>- ast_cli(a->fd,"Talking Threshold: %ums\n",<br>+ ast_cli(a->fd,"Talking Threshold: %u\n",<br> u_profile.talking_threshold);<br> ast_cli(a->fd,"Denoise: %s\n",<br> u_profile.flags & USER_OPT_DENOISE ?<br>diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h<br>index 162ff22..044ab40 100644<br>--- a/apps/confbridge/include/confbridge.h<br>+++ b/apps/confbridge/include/confbridge.h<br>@@ -41,7 +41,10 @@<br> #define DEFAULT_BRIDGE_PROFILE "default_bridge"<br> #define DEFAULT_MENU_PROFILE "default_menu"<br> <br>+/*! Default minimum average magnitude threshold to determine talking by the DSP. */<br> #define DEFAULT_TALKING_THRESHOLD 160<br>+<br>+/*! Default time in ms of silence necessary to declare talking stopped by the bridge. */<br> #define DEFAULT_SILENCE_THRESHOLD 2500<br> <br> enum user_profile_flags {<br>@@ -140,9 +143,9 @@<br> char announcement[PATH_MAX];<br> unsigned int flags;<br> unsigned int announce_user_count_all_after;<br>- /*! The time in ms of talking before a user is considered to be talking by the dsp. */<br>+ /*! Minimum average magnitude threshold to determine talking by the DSP. */<br> unsigned int talking_threshold;<br>- /*! The time in ms of silence before a user is considered to be silent by the dsp. */<br>+ /*! Time in ms of silence necessary to declare talking stopped by the bridge. */<br> unsigned int silence_threshold;<br> /*! The time in ms the user may stay in the confbridge */<br> unsigned int timeout;<br>diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c<br>index 1ff92ad..c266367 100644<br>--- a/bridges/bridge_softmix.c<br>+++ b/bridges/bridge_softmix.c<br>@@ -53,9 +53,16 @@<br> /*! \brief Number of mixing iterations to perform between gathering statistics. */<br> #define SOFTMIX_STAT_INTERVAL 100<br> <br>-/* This is the threshold in ms at which a channel's own audio will stop getting<br>- * mixed out its own write audio stream because it is not talking. */<br>+/*!<br>+ * \brief Default time in ms of silence necessary to declare talking stopped by the bridge.<br>+ *<br>+ * \details<br>+ * This is the time at which a channel's own audio will stop getting<br>+ * mixed out of its own write audio stream because it is no longer talking.<br>+ */<br> #define DEFAULT_SOFTMIX_SILENCE_THRESHOLD 2500<br>+<br>+/*! Default minimum average magnitude threshold to determine talking by the DSP. */<br> #define DEFAULT_SOFTMIX_TALKING_THRESHOLD 160<br> <br> #define SOFTBRIDGE_VIDEO_DEST_PREFIX "softbridge_dest"<br>diff --git a/configs/samples/confbridge.conf.sample b/configs/samples/confbridge.conf.sample<br>index c8f30bc..e2d8a62 100644<br>--- a/configs/samples/confbridge.conf.sample<br>+++ b/configs/samples/confbridge.conf.sample<br>@@ -49,59 +49,67 @@<br> ; noise from the conference. Highly recommended for large conferences<br> ; due to its performance enhancements.<br> <br>-;dsp_talking_threshold=128 ; The time in milliseconds of sound above what the dsp has<br>- ; established as base line silence for a user before a user<br>- ; is considered to be talking. This value affects several<br>+;dsp_talking_threshold=128 ; Average magnitude threshold to determine talking.<br>+ ;<br>+ ; The minimum average magnitude per sample in a frame for the<br>+ ; DSP to consider talking/noise present. A value below this<br>+ ; level is considered silence. This value affects several<br> ; operations and should not be changed unless the impact on<br> ; call quality is fully understood.<br> ;<br> ; What this value affects internally:<br> ;<br>- ; 1. Audio is only mixed out of a user's incoming audio stream<br>- ; if talking is detected. If this value is set too<br>- ; loose the user will hear themselves briefly each<br>- ; time they begin talking until the dsp has time to<br>- ; establish that they are in fact talking.<br>- ; 2. When talk detection AMI events are enabled, this value<br>- ; determines when talking has begun which results in<br>- ; an AMI event to fire. If this value is set too tight<br>- ; AMI events may be falsely triggered by variants in<br>- ; room noise.<br>- ; 3. The drop_silence option depends on this value to determine<br>- ; when the user's audio should be mixed into the bridge<br>- ; after periods of silence. If this value is too loose<br>- ; the beginning of a user's speech will get cut off as they<br>- ; transition from silence to talking.<br>+ ; 1. Audio is only mixed out of a user's incoming audio<br>+ ; stream if talking is detected. If this value is set too<br>+ ; high the user will hear himself talking.<br> ;<br>- ; By default this value is 160 ms. Valid values are 1 through 2^31<br>+ ; 2. When talk detection AMI events are enabled, this value<br>+ ; determines when talking has begun which results in an<br>+ ; AMI event to fire. If this value is set too low AMI<br>+ ; events may be falsely triggered by variants in room<br>+ ; noise.<br>+ ;<br>+ ; 3. The 'drop_silence' option depends on this value to<br>+ ; determine when the user's audio should be mixed into the<br>+ ; bridge after periods of silence. If this value is too<br>+ ; high the user's speech will get discarded as they will<br>+ ; be considered silent.<br>+ ;<br>+ ; Valid values are 1 through 2^15.<br>+ ; By default this value is 160.<br> <br>-;dsp_silence_threshold=2000 ; The time in milliseconds of sound falling within the what<br>- ; the dsp has established as baseline silence before a user<br>- ; is considered be silent. This value affects several<br>- ; operations and should not be changed unless the impact<br>- ; on call quality is fully understood.<br>+;dsp_silence_threshold=2000 ; The number of milliseconds of silence necessary to declare<br>+ ; talking stopped.<br>+ ;<br>+ ; The time in milliseconds of sound falling below the<br>+ ; 'dsp_talking_threshold' option when a user is considered to<br>+ ; stop talking. This value affects several operations and<br>+ ; should not be changed unless the impact on call quality is<br>+ ; fully understood.<br> ;<br> ; What this value affects internally:<br> ;<br> ; 1. When talk detection AMI events are enabled, this value<br> ; determines when the user has stopped talking after a<br>- ; period of talking. If this value is set too low<br>- ; AMI events indicating the user has stopped talking<br>- ; may get falsely sent out when the user briefly pauses<br>- ; during mid sentence.<br>- ; 2. The drop_silence option depends on this value to<br>+ ; period of talking. If this value is set too low AMI<br>+ ; events indicating the user has stopped talking may get<br>+ ; falsely sent out when the user briefly pauses during mid<br>+ ; sentence.<br>+ ;<br>+ ; 2. The 'drop_silence' option depends on this value to<br> ; determine when the user's audio should begin to be<br>- ; dropped from the conference bridge after the user<br>- ; stops talking. If this value is set too low the user's<br>- ; audio stream may sound choppy to the other participants.<br>- ; This is caused by the user transitioning constantly from<br>+ ; dropped from the conference bridge after the user stops<br>+ ; talking. If this value is set too low the user's audio<br>+ ; stream may sound choppy to the other participants. This<br>+ ; is caused by the user transitioning constantly from<br> ; silence to talking during mid sentence.<br> ;<br>- ; The best way to approach this option is to set it slightly above<br>- ; the maximum amount of ms of silence a user may generate during<br>- ; natural speech.<br>+ ; The best way to approach this option is to set it slightly<br>+ ; above the maximum amount of milliseconds of silence a user<br>+ ; may generate during natural speech.<br> ;<br>- ; By default this value is 2500ms. Valid values are 1 through 2^31<br>+ ; Valid values are 1 through 2^31.<br>+ ; By default this value is 2500ms.<br> <br> ;talk_detection_events=yes ; This option sets whether or not notifications of when a user<br> ; begins and ends talking should be sent out as events over AMI.<br>diff --git a/include/asterisk/bridge_technology.h b/include/asterisk/bridge_technology.h<br>index eaea28d..12fd499 100644<br>--- a/include/asterisk/bridge_technology.h<br>+++ b/include/asterisk/bridge_technology.h<br>@@ -46,11 +46,9 @@<br> * performing talking optimizations.<br> */<br> struct ast_bridge_tech_optimizations {<br>- /*! The amount of time in ms that talking must be detected before<br>- * the dsp determines that talking has occurred */<br>+ /*! Minimum average magnitude threshold to determine talking by the DSP. */<br> unsigned int talking_threshold;<br>- /*! The amount of time in ms that silence must be detected before<br>- * the dsp determines that talking has stopped */<br>+ /*! Time in ms of silence necessary to declare talking stopped by the bridge. */<br> unsigned int silence_threshold;<br> /*! Whether or not the bridging technology should drop audio<br> * detected as silence from the mix. */<br>diff --git a/include/asterisk/dsp.h b/include/asterisk/dsp.h<br>index 7e84ebe..d092e6b 100644<br>--- a/include/asterisk/dsp.h<br>+++ b/include/asterisk/dsp.h<br>@@ -87,7 +87,7 @@<br> * created with */<br> unsigned int ast_dsp_get_sample_rate(const struct ast_dsp *dsp);<br> <br>-/*! \brief Set threshold value for silence */<br>+/*! \brief Set the minimum average magnitude threshold to determine talking by the DSP. */<br> void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold);<br> <br> /*! \brief Set number of required cadences for busy */<br>@@ -106,19 +106,41 @@<br> busies, and call progress, all dependent upon which features are enabled */<br> struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf);<br> <br>-/*! \brief Return non-zero if this is silence. Updates "totalsilence" with the total<br>- number of seconds of silence */<br>+/*!<br>+ * \brief Process the audio frame for silence.<br>+ *<br>+ * \param dsp DSP processing audio media.<br>+ * \param f Audio frame to process.<br>+ * \param totalsilence Variable to set to the total accumulated silence in ms<br>+ * seen by the DSP since the last noise.<br>+ *<br>+ * \return Non-zero if the frame is silence.<br>+ */<br> int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence);<br> <br>-/*! \brief Return non-zero if this is silence. Updates "totalsilence" with the total<br>- number of seconds of silence. Returns the average energy of the samples in the frame<br>- in frames_energy variable. */<br>+/*!<br>+ * \brief Process the audio frame for silence.<br>+ *<br>+ * \param dsp DSP processing audio media.<br>+ * \param f Audio frame to process.<br>+ * \param totalsilence Variable to set to the total accumulated silence in ms<br>+ * seen by the DSP since the last noise.<br>+ * \param frames_energy Variable to set to the average energy of the samples in the frame.<br>+ *<br>+ * \return Non-zero if the frame is silence.<br>+ */<br> int ast_dsp_silence_with_energy(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence, int *frames_energy);<br> <br> /*!<br>- * \brief Return non-zero if this is noise. Updates "totalnoise" with the total<br>- * number of seconds of noise<br>+ * \brief Process the audio frame for noise.<br> * \since 1.6.1<br>+ *<br>+ * \param dsp DSP processing audio media.<br>+ * \param f Audio frame to process.<br>+ * \param totalnoise Variable to set to the total accumulated noise in ms<br>+ * seen by the DSP since the last silence.<br>+ *<br>+ * \return Non-zero if the frame is silence.<br> */<br> int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise);<br> <br>diff --git a/main/dsp.c b/main/dsp.c<br>index e4e7fd3..8b39fe5 100644<br>--- a/main/dsp.c<br>+++ b/main/dsp.c<br>@@ -122,12 +122,19 @@<br> { GSAMP_SIZE_UK, { 350, 400, 440 } }, /*!< UK */<br> };<br> <br>-/*!\brief This value is the minimum threshold, calculated by averaging all<br>- * of the samples within a frame, for which a frame is determined to either<br>- * be silence (below the threshold) or noise (above the threshold). Please<br>- * note that while the default threshold is an even exponent of 2, there is<br>- * no requirement that it be so. The threshold will accept any value between<br>- * 0 and 32767.<br>+/*!<br>+ * \brief Default minimum average magnitude threshold to determine talking/noise by the DSP.<br>+ *<br>+ * \details<br>+ * The magnitude calculated for this threshold is determined by<br>+ * averaging the absolute value of all samples within a frame.<br>+ *<br>+ * This value is the threshold for which a frame's average magnitude<br>+ * is determined to either be silence (below the threshold) or<br>+ * noise/talking (at or above the threshold). Please note that while<br>+ * the default threshold is an even exponent of 2, there is no<br>+ * requirement that it be so. The threshold will work for any value<br>+ * between 1 and 2^15.<br> */<br> #define DEFAULT_THRESHOLD 512<br> <br>@@ -397,7 +404,9 @@<br> struct ast_dsp {<br> struct ast_frame f;<br> int threshold;<br>+ /*! Accumulated total silence in ms since last talking/noise. */<br> int totalsilence;<br>+ /*! Accumulated total talking/noise in ms since last silence. */<br> int totalnoise;<br> int features;<br> int ringtimeout;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8116">change 8116</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8116"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: If6f939c100eb92a5ac6c21236559018eeaf58443 </div>
<div style="display:none"> Gerrit-Change-Number: 8116 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>