mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 16:20:37 +00:00
Video support for ConfBridge.
Review: https://reviewboard.asterisk.org/r/1288/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@325931 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
29
main/dsp.c
29
main/dsp.c
@@ -1103,7 +1103,7 @@ int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf)
|
||||
return __ast_dsp_call_progress(dsp, inf->data.ptr, inf->datalen / 2);
|
||||
}
|
||||
|
||||
static int __ast_dsp_silence_noise(struct ast_dsp *dsp, short *s, int len, int *totalsilence, int *totalnoise)
|
||||
static int __ast_dsp_silence_noise(struct ast_dsp *dsp, short *s, int len, int *totalsilence, int *totalnoise, int *frames_energy)
|
||||
{
|
||||
int accum;
|
||||
int x;
|
||||
@@ -1163,6 +1163,9 @@ static int __ast_dsp_silence_noise(struct ast_dsp *dsp, short *s, int len, int *
|
||||
if (totalnoise) {
|
||||
*totalnoise = dsp->totalnoise;
|
||||
}
|
||||
if (frames_energy) {
|
||||
*frames_energy = accum;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1318,7 +1321,25 @@ int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
|
||||
}
|
||||
s = f->data.ptr;
|
||||
len = f->datalen/2;
|
||||
return __ast_dsp_silence_noise(dsp, s, len, totalsilence, NULL);
|
||||
return __ast_dsp_silence_noise(dsp, s, len, totalsilence, NULL, NULL);
|
||||
}
|
||||
|
||||
int ast_dsp_silence_with_energy(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence, int *frames_energy)
|
||||
{
|
||||
short *s;
|
||||
int len;
|
||||
|
||||
if (f->frametype != AST_FRAME_VOICE) {
|
||||
ast_log(LOG_WARNING, "Can't calculate silence on a non-voice frame\n");
|
||||
return 0;
|
||||
}
|
||||
if (!ast_format_is_slinear(&f->subclass.format)) {
|
||||
ast_log(LOG_WARNING, "Can only calculate silence on signed-linear frames :(\n");
|
||||
return 0;
|
||||
}
|
||||
s = f->data.ptr;
|
||||
len = f->datalen/2;
|
||||
return __ast_dsp_silence_noise(dsp, s, len, totalsilence, NULL, frames_energy);
|
||||
}
|
||||
|
||||
int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise)
|
||||
@@ -1336,7 +1357,7 @@ int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise)
|
||||
}
|
||||
s = f->data.ptr;
|
||||
len = f->datalen/2;
|
||||
return __ast_dsp_silence_noise(dsp, s, len, NULL, totalnoise);
|
||||
return __ast_dsp_silence_noise(dsp, s, len, NULL, totalnoise, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1393,7 +1414,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
|
||||
|
||||
/* Need to run the silence detection stuff for silence suppression and busy detection */
|
||||
if ((dsp->features & DSP_FEATURE_SILENCE_SUPPRESS) || (dsp->features & DSP_FEATURE_BUSY_DETECT)) {
|
||||
res = __ast_dsp_silence_noise(dsp, shortdata, len, &silence, NULL);
|
||||
res = __ast_dsp_silence_noise(dsp, shortdata, len, &silence, NULL, NULL);
|
||||
}
|
||||
|
||||
if ((dsp->features & DSP_FEATURE_SILENCE_SUPPRESS) && silence) {
|
||||
|
||||
Reference in New Issue
Block a user