Version 0.1.9 from FTP

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@323 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2001-05-15 22:02:25 +00:00
parent dd539444bb
commit d9a7d03d8d
2 changed files with 18 additions and 14 deletions

View File

@@ -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;
}