mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
Fix wav format (bug #3837)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5233 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -55,7 +55,6 @@ struct ast_filestream {
|
|||||||
weird MS format */
|
weird MS format */
|
||||||
/* This is what a filestream means to us */
|
/* This is what a filestream means to us */
|
||||||
int fd; /* Descriptor */
|
int fd; /* Descriptor */
|
||||||
int bytes;
|
|
||||||
struct ast_frame fr; /* Frame information */
|
struct ast_frame fr; /* Frame information */
|
||||||
char waste[AST_FRIENDLY_OFFSET]; /* Buffer for sending frames, etc */
|
char waste[AST_FRIENDLY_OFFSET]; /* Buffer for sending frames, etc */
|
||||||
char empty; /* Empty character */
|
char empty; /* Empty character */
|
||||||
@@ -402,7 +401,7 @@ static void wav_close(struct ast_filestream *s)
|
|||||||
ast_mutex_unlock(&wav_lock);
|
ast_mutex_unlock(&wav_lock);
|
||||||
ast_update_use_count();
|
ast_update_use_count();
|
||||||
/* Pad to even length */
|
/* Pad to even length */
|
||||||
if (s->bytes & 0x1)
|
if (lseek(s->fd, 0, SEEK_END) & 0x1)
|
||||||
write(s->fd, &zero, 1);
|
write(s->fd, &zero, 1);
|
||||||
close(s->fd);
|
close(s->fd);
|
||||||
free(s);
|
free(s);
|
||||||
@@ -462,7 +461,6 @@ static int wav_write(struct ast_filestream *fs, struct ast_frame *f)
|
|||||||
ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno));
|
ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fs->bytes += 65;
|
|
||||||
update_header(fs->fd);
|
update_header(fs->fd);
|
||||||
len += 65;
|
len += 65;
|
||||||
} else {
|
} else {
|
||||||
@@ -473,7 +471,6 @@ static int wav_write(struct ast_filestream *fs, struct ast_frame *f)
|
|||||||
ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno));
|
ast_log(LOG_WARNING, "Bad write (%d/65): %s\n", res, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fs->bytes += 65;
|
|
||||||
update_header(fs->fd);
|
update_header(fs->fd);
|
||||||
} else {
|
} else {
|
||||||
/* Copy the data and do nothing */
|
/* Copy the data and do nothing */
|
||||||
|
Reference in New Issue
Block a user