summaryrefslogtreecommitdiff
path: root/codecs
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2000-07-25 20:04:15 +0000
committerMark Spencer <markster@digium.com>2000-07-25 20:04:15 +0000
commite47ab6be7a13070844e7db314d9f26443d5cd12e (patch)
tree02c7148054efa0b4fb7c864056f25cb1a13afc45 /codecs
parent760f0507e4aec1d5d3c43f569fb875334dc1a24e (diff)
Version 0.1.4 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'codecs')
-rwxr-xr-xcodecs/codec_g723_1.c18
-rwxr-xr-xcodecs/codec_gsm.c18
2 files changed, 16 insertions, 20 deletions
diff --git a/codecs/codec_g723_1.c b/codecs/codec_g723_1.c
index b71e28cc2..72dcd9013 100755
--- a/codecs/codec_g723_1.c
+++ b/codecs/codec_g723_1.c
@@ -173,16 +173,14 @@ static struct ast_frame *g723tolin_frameout(struct ast_translator_pvt *pvt)
tmp->tail = 0;
#if 0
- /* Save a sample frame */
- { static int samplefr = 0;
- if (samplefr == 80) {
- int fd;
- fd = open("g723.example", O_WRONLY | O_CREAT | O_TRUNC, 0644);
- write(fd, tmp->f.data, tmp->f.datalen);
- close(fd);
+ /* Save the frames */
+ {
+ static int fd2 = -1;
+ if (fd2 == -1) {
+ fd2 = open("g723.example", O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ }
+ write(fd2, tmp->f.data, tmp->f.datalen);
}
- samplefr++;
- }
#endif
return &tmp->f;
}
@@ -200,7 +198,7 @@ static int g723tolin_framein(struct ast_translator_pvt *pvt, struct ast_frame *f
#ifdef ANNEX_B
Decod(&tmp->dec, tmpdata, f->data, 0);
for (x=0;x<Frame;x++)
- (tmp->buf + tmp->tail)[x] = (short)tmpdata[x];
+ (tmp->buf + tmp->tail)[x] = (short)(tmpdata[x]);
#else
Decod(&tmp->dec, tmp->buf + tmp->tail, f->data, 0);
#endif
diff --git a/codecs/codec_gsm.c b/codecs/codec_gsm.c
index 169371230..9d43f3906 100755
--- a/codecs/codec_gsm.c
+++ b/codecs/codec_gsm.c
@@ -156,7 +156,7 @@ static int lintogsm_framein(struct ast_translator_pvt *tmp, struct ast_frame *f)
/* XXX We should look at how old the rest of our stream is, and if it
is too old, then we should overwrite it entirely, otherwise we can
get artifacts of earlier talk that do not belong */
- if (tmp->tail + f->datalen < sizeof(tmp->buf) / 2) {
+ if (tmp->tail + f->datalen/2 < sizeof(tmp->buf) / 2) {
memcpy((tmp->buf + tmp->tail), f->data, f->datalen);
tmp->tail += f->datalen/2;
} else {
@@ -187,16 +187,14 @@ static struct ast_frame *lintogsm_frameout(struct ast_translator_pvt *tmp)
if (tmp->tail)
memmove(tmp->buf, tmp->buf + 160, tmp->tail * 2);
#if 0
- /* Save a sample frame */
- { static int samplefr = 0;
- if (samplefr == 0) {
- int fd;
- fd = open("gsm.example", O_WRONLY | O_CREAT, 0644);
- write(fd, tmp->f.data, tmp->f.datalen);
- close(fd);
+ /* Save the frames */
+ {
+ static int fd2 = -1;
+ if (fd2 == -1) {
+ fd2 = open("gsm.example", O_WRONLY | O_CREAT | O_TRUNC, 0644);
+ }
+ write(fd2, tmp->f.data, tmp->f.datalen);
}
- samplefr++;
- }
#endif
return &tmp->f;
}