mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Only update total silence counter after a counter reset.
(closes issue #2264) Reported by: pfn Patches: silent-vm-1.6.2-fix2.txt uploaded by pfn (license 810) Tested by: pfn git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203962 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
10
main/app.c
10
main/app.c
@@ -700,6 +700,7 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
|||||||
struct ast_dsp *sildet = NULL; /* silence detector dsp */
|
struct ast_dsp *sildet = NULL; /* silence detector dsp */
|
||||||
int totalsilence = 0;
|
int totalsilence = 0;
|
||||||
int dspsilence = 0;
|
int dspsilence = 0;
|
||||||
|
int olddspsilence = 0;
|
||||||
int rfmt = 0;
|
int rfmt = 0;
|
||||||
struct ast_silence_generator *silgen = NULL;
|
struct ast_silence_generator *silgen = NULL;
|
||||||
char prependfile[80];
|
char prependfile[80];
|
||||||
@@ -826,7 +827,10 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
|||||||
if (maxsilence > 0) {
|
if (maxsilence > 0) {
|
||||||
dspsilence = 0;
|
dspsilence = 0;
|
||||||
ast_dsp_silence(sildet, f, &dspsilence);
|
ast_dsp_silence(sildet, f, &dspsilence);
|
||||||
totalsilence += dspsilence;
|
if (olddspsilence > dspsilence) {
|
||||||
|
totalsilence += olddspsilence;
|
||||||
|
}
|
||||||
|
olddspsilence = dspsilence;
|
||||||
|
|
||||||
if (dspsilence > maxsilence) {
|
if (dspsilence > maxsilence) {
|
||||||
/* Ended happily with silence */
|
/* Ended happily with silence */
|
||||||
@@ -906,6 +910,10 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
|||||||
|
|
||||||
if (!prepend) {
|
if (!prepend) {
|
||||||
/* Reduce duration by a total silence amount */
|
/* Reduce duration by a total silence amount */
|
||||||
|
if (olddspsilence <= dspsilence) {
|
||||||
|
totalsilence += dspsilence;
|
||||||
|
}
|
||||||
|
|
||||||
if (totalsilence > 0)
|
if (totalsilence > 0)
|
||||||
*duration -= (totalsilence - 200) / 1000;
|
*duration -= (totalsilence - 200) / 1000;
|
||||||
if (*duration < 0) {
|
if (*duration < 0) {
|
||||||
|
Reference in New Issue
Block a user