Skip to content
Snippets Groups Projects
Commit f75d794c authored by Shaun Ruffell's avatar Shaun Ruffell
Browse files

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: https://origsvn.digium.com/svn/asterisk/trunk@139153 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 3e1f8725
No related branches found
No related tags found
No related merge requests found
...@@ -82,11 +82,8 @@ static AST_LIST_HEAD_STATIC(translators, translator); ...@@ -82,11 +82,8 @@ static AST_LIST_HEAD_STATIC(translators, translator);
struct pvt { struct pvt {
int fd; int fd;
int fake; int fake;
#ifdef DEBUG_TRANSCODE
int totalms;
int lasttotalms;
#endif
struct dahdi_transcoder_formats fmts; struct dahdi_transcoder_formats fmts;
int samples;
}; };
static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
...@@ -111,6 +108,7 @@ static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct ...@@ -111,6 +108,7 @@ static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct
if (copy.total == 0) if (copy.total == 0)
ast_cli(a->fd, "No DAHDI transcoders found.\n"); ast_cli(a->fd, "No DAHDI transcoders found.\n");
ast_debug(1, "codec_dahdi.so loaded.\n");
else else
ast_cli(a->fd, "%d/%d encoders/decoders of %d channels are in use.\n", copy.encoders, copy.decoders, copy.total); ast_cli(a->fd, "%d/%d encoders/decoders of %d channels are in use.\n", copy.encoders, copy.decoders, copy.total);
...@@ -159,7 +157,7 @@ static struct ast_frame *dahdi_frameout(struct ast_trans_pvt *pvt) ...@@ -159,7 +157,7 @@ static struct ast_frame *dahdi_frameout(struct ast_trans_pvt *pvt)
return NULL; return NULL;
} }
} else { } else {
pvt->f.samples = res; pvt->f.samples = dahdip->samples;
pvt->f.datalen = res; pvt->f.datalen = res;
pvt->datalen = 0; pvt->datalen = 0;
pvt->f.frametype = AST_FRAME_VOICE; pvt->f.frametype = AST_FRAME_VOICE;
...@@ -248,10 +246,14 @@ static int dahdi_translate(struct ast_trans_pvt *pvt, int dest, int source) ...@@ -248,10 +246,14 @@ static int dahdi_translate(struct ast_trans_pvt *pvt, int dest, int source)
switch (dahdip->fmts.dstfmt) { switch (dahdip->fmts.dstfmt) {
case AST_FORMAT_G729A: case AST_FORMAT_G729A:
dahdip->samples = 160;
break;
case AST_FORMAT_G723_1: case AST_FORMAT_G723_1:
dahdip->samples = 240;
ast_atomic_fetchadd_int(&channels.encoders, +1); ast_atomic_fetchadd_int(&channels.encoders, +1);
break; break;
default: default:
dahdip->samples = 160;
ast_atomic_fetchadd_int(&channels.decoders, +1); ast_atomic_fetchadd_int(&channels.decoders, +1);
break; break;
} }
...@@ -446,6 +448,7 @@ static int unload_module(void) ...@@ -446,6 +448,7 @@ static int unload_module(void)
static int load_module(void) static int load_module(void)
{ {
ast_debug(1, "codec_dahdi.so loaded.\n");
if (parse_config(0)) if (parse_config(0))
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
find_transcoders(); find_transcoders();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment