aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsruffell <sruffell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-20 19:52:25 +0000
committersruffell <sruffell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-20 19:52:25 +0000
commitc389398945c8b2b757f5beb0870dc5f1522baa07 (patch)
treeed20dca129e18afa48aebedd0b15d7a1e06e67eb
parent892056dbc69137f78a8036fcda23ec6fcf1808b2 (diff)
Fix bug where the samples were not accurate when in G723 mode, which would
cause the timestamp field of the RTP header to be invalid. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@139151 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--codecs/codec_dahdi.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/codecs/codec_dahdi.c b/codecs/codec_dahdi.c
index 321dac4d7..a68b3dcab 100644
--- a/codecs/codec_dahdi.c
+++ b/codecs/codec_dahdi.c
@@ -108,11 +108,7 @@ static AST_LIST_HEAD_STATIC(translators, translator);
struct pvt {
int fd;
int fake;
- unsigned int g729b_warning:1;
-#ifdef DEBUG_TRANSCODE
- int totalms;
- int lasttotalms;
-#endif
+ int samples;
struct dahdi_transcoder_formats fmts;
};
@@ -172,7 +168,7 @@ static struct ast_frame *zap_frameout(struct ast_trans_pvt *pvt)
return NULL;
}
} else {
- pvt->f.samples = res;
+ pvt->f.samples = ztp->samples;
pvt->f.datalen = res;
pvt->datalen = 0;
pvt->f.frametype = AST_FRAME_VOICE;
@@ -268,6 +264,20 @@ static int zap_translate(struct ast_trans_pvt *pvt, int dest, int source)
switch (ztp->fmts.dstfmt) {
case AST_FORMAT_G729A:
+ ztp->samples = 160;
+ break;
+ case AST_FORMAT_G723_1:
+ ztp->samples = 240;
+ break;
+ default:
+ ztp->samples = 160;
+ break;
+ };
+
+ switch (ztp->fmts.dstfmt) {
+ case AST_FORMAT_G729A:
+ ast_atomic_fetchadd_int(&channels.encoders, +1);
+ break;
case AST_FORMAT_G723_1:
ast_atomic_fetchadd_int(&channels.encoders, +1);
break;