diff options
author | Mark Spencer <markster@digium.com> | 2001-05-15 22:02:25 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2001-05-15 22:02:25 +0000 |
commit | d9a7d03d8d2692d31072b046da69a82ed7a33d68 (patch) | |
tree | fdc6ce804f8578c0f751c6f6d0f9f8aaf66e8364 /formats | |
parent | dd539444bba8e519e1f34f5baa97ae535a7ad628 (diff) |
Version 0.1.9 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'formats')
-rwxr-xr-x | formats/format_wav_gsm.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c index a7292043a..679b714a9 100755 --- a/formats/format_wav_gsm.c +++ b/formats/format_wav_gsm.c @@ -504,6 +504,7 @@ static int wav_write(struct ast_filestream *fs, struct ast_frame *f) { int res; char msdata[66]; + int len =0; if (f->frametype != AST_FRAME_VOICE) { ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); return -1; @@ -512,20 +513,23 @@ static int wav_write(struct ast_filestream *fs, struct ast_frame *f) ast_log(LOG_WARNING, "Asked to write non-GSM frame (%d)!\n", f->subclass); return -1; } - if (fs->secondhalf) { - memcpy(fs->gsm + 33, f->data, 33); - conv66(fs->gsm, msdata); - if ((res = write(fs->fd, msdata, 65)) != 65) { - ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno)); - return -1; + while(len < f->datalen) { + if (fs->secondhalf) { + memcpy(fs->gsm + 33, f->data + len, 33); + conv66(fs->gsm, msdata); + if ((res = write(fs->fd, msdata, 65)) != 65) { + ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno)); + return -1; + } + fs->bytes += 65; + update_header(fs->fd, fs->bytes); + } else { + /* Copy the data and do nothing */ + memcpy(fs->gsm, f->data + len, 33); } - fs->bytes += 65; - update_header(fs->fd, fs->bytes); - } else { - /* Copy the data and do nothing */ - memcpy(fs->gsm, f->data, 33); + fs->secondhalf = !fs->secondhalf; + len += 33; } - fs->secondhalf = !fs->secondhalf; return 0; } |