aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-07 22:30:59 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-07 22:30:59 +0000
commite136240e1664135ba5c3477326d8fec35461e283 (patch)
treea40fdfbce91200f11318362e4c418602628c6893
parent57bb3e34aa073102a984605804bbf4525ccdea82 (diff)
even though Asterisk explicitly requests that endpoints using G.729 do *not* use Annex B (silence detection and comfort noise generation) some do anyway; the transcoder card interface does not currently work properly with CNG frames, so trim off the CNG before sending the data
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@91870 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--codecs/codec_zap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/codecs/codec_zap.c b/codecs/codec_zap.c
index 79ac8b313..aa08667e2 100644
--- a/codecs/codec_zap.c
+++ b/codecs/codec_zap.c
@@ -146,6 +146,15 @@ static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
/* Copy at front of buffer */
hdr->srcoffset = 0;
+ /* if we get handed a G.729 frame that is not a multiple of
+ 10 bytes (10 milliseconds), then it has a CNG frame and
+ we need to avoid sending that to the transcoder
+ */
+ if ((f->subclass == AST_FORMAT_G729A) && ((f->datalen % 10) != 0)) {
+ f->datalen -= f->datalen % 10;
+ f->samples = f->datalen * 8;
+ }
+
if (hdr->srclen + f->datalen > sizeof(hdr->srcdata)) {
ast_log(LOG_WARNING, "Out of space for codec translation!\n");
return -1;