diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-08-14 17:00:21 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-08-14 17:00:21 +0000 |
commit | 7701aaa68a31b0138f7916f9d938a8a3fb6559e4 (patch) | |
tree | eb31568ecd3445bc2a03e9a3b37323f76984edc4 | |
parent | 11ed693db581f8866fd55c8454102539fd8e54cf (diff) |
Added maximum threshold for silence detector, to aovid the silence detector setting the threshold too high thus cutting audio signal (e.g. when streaming long continuous signal)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2215 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjmedia/include/pjmedia/config.h | 12 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/silencedet.c | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h index 7d053f5d..46bf18b9 100644 --- a/pjmedia/include/pjmedia/config.h +++ b/pjmedia/include/pjmedia/config.h @@ -429,6 +429,18 @@ /** + * Maximum silence threshold in the silence detector. The silence detector + * will not cut the audio transmission if the audio level is above this + * level. + * + * Default: 25 + */ +#ifndef PJMEDIA_SILENCE_DET_MAX_THRESHOLD +# define PJMEDIA_SILENCE_DET_MAX_THRESHOLD 25 +#endif + + +/** * Speex Accoustic Echo Cancellation (AEC). * By default is enabled. */ diff --git a/pjmedia/src/pjmedia/silencedet.c b/pjmedia/src/pjmedia/silencedet.c index d827ce4b..f5d29e6c 100644 --- a/pjmedia/src/pjmedia/silencedet.c +++ b/pjmedia/src/pjmedia/silencedet.c @@ -267,6 +267,9 @@ PJ_DEF(pj_bool_t) pjmedia_silence_det_apply( pjmedia_silence_det *sd, updated = PJ_FALSE; } + if (new_threshold > PJMEDIA_SILENCE_DET_MAX_THRESHOLD) + new_threshold = PJMEDIA_SILENCE_DET_MAX_THRESHOLD; + if (updated && sd->cur_threshold != new_threshold) { PJ_LOG(5,(sd->objname, "Vad cur_threshold updated %d-->%d. " |