[svn-commits] oej: branch oej/silence-detection-games-1.8 r411916 - in /team/oej/silence-de...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Apr 8 04:07:25 CDT 2014
Author: oej
Date: Tue Apr 8 04:07:16 2014
New Revision: 411916
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411916
Log:
Drop only when we are over the treshold
Modified:
team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h
team/oej/silence-detection-games-1.8/main/silencedetection.c
Modified: team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h?view=diff&rev=411916&r1=411915&r2=411916
==============================================================================
--- team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h (original)
+++ team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h Tue Apr 8 04:07:16 2014
@@ -31,6 +31,9 @@
\param chan The channel
\param silencelevel Audio treshold for silence
\param silenceframes Number of frames before we react
+
+ \note That this function assumes the channel is set to read signed linear audio
+
*/
int ast_sildet_activate(struct ast_channel *chan, unsigned int silencelevel, unsigned int silenceframes);
Modified: team/oej/silence-detection-games-1.8/main/silencedetection.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/silence-detection-games-1.8/main/silencedetection.c?view=diff&rev=411916&r1=411915&r2=411916
==============================================================================
--- team/oej/silence-detection-games-1.8/main/silencedetection.c (original)
+++ team/oej/silence-detection-games-1.8/main/silencedetection.c Tue Apr 8 04:07:16 2014
@@ -121,8 +121,7 @@
/* Based on direction of frame grab the gain, and confirm it is applicable */
if (direction == AST_AUDIOHOOK_DIRECTION_WRITE) {
- /* DETECT SILENCE HERE */
- ast_dsp_silence(sildet->dsp, frame, &dsptime);
+ ast_dsp_silence(sildet->dsp, frame, &dsptime); /* Checking for silence */
if (option_debug && sildet->silencecounter == 0 && dsptime) {
ast_debug(8, " ++++ Silence started ++++ on chan %s\n", chan->name);
}
@@ -136,11 +135,13 @@
if (option_debug && sildet->silencecounter > 0) {
ast_debug(9, " ++++ Silence continues %d ++++ on chan %s\n", sildet->silencecounter, chan->name);
}
- sildet->silencecounter++;
- ast_frame_clear(frame); /* Should really be dropped. */
- frame->frametype = AST_FRAME_DROP;
- ast_channel_unlock(chan);
- return 1; /* Return TRUE since we manipulated the frame */
+ if (sildet_detect == 1 && sildet->silencecounter > sildet->silenceframes) {
+ sildet->silencecounter++;
+ ast_frame_clear(frame); /* Should really be dropped. */
+ frame->frametype = AST_FRAME_DROP;
+ ast_channel_unlock(chan);
+ return 1; /* Return TRUE since we manipulated the frame */
+ }
}
if (sildet->detect == 0 && sildet->silencecounter > sildet->silenceframes) {
ast_debug(8, " ++++ Silence suppression should start now ++++ on chan %s\n", chan->name);
More information about the svn-commits
mailing list