aboutsummaryrefslogtreecommitdiffstats
path: root/formats
diff options
context:
space:
mode:
Diffstat (limited to 'formats')
-rwxr-xr-xformats/format_g729.c2
-rwxr-xr-xformats/format_sln.c1
-rwxr-xr-xformats/format_wav_gsm.c7
3 files changed, 4 insertions, 6 deletions
diff --git a/formats/format_g729.c b/formats/format_g729.c
index 746874d7d..55b5fcbb9 100755
--- a/formats/format_g729.c
+++ b/formats/format_g729.c
@@ -130,7 +130,7 @@ static struct ast_frame *g729_read(struct ast_filestream *s, int *whennext)
s->fr.mallocd = 0;
s->fr.data = s->g729;
if ((res = read(s->fd, s->g729, 20)) != 20) {
- if (res)
+ if (res && (res != 10))
ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));
return NULL;
}
diff --git a/formats/format_sln.c b/formats/format_sln.c
index 7e77876b2..224054775 100755
--- a/formats/format_sln.c
+++ b/formats/format_sln.c
@@ -160,6 +160,7 @@ static int slinear_seek(struct ast_filestream *fs, long sample_offset, int whenc
off_t offset=0,min,cur,max;
min = 0;
+ sample_offset <<= 1;
cur = lseek(fs->fd, 0, SEEK_CUR);
max = lseek(fs->fd, 0, SEEK_END);
if (whence == SEEK_SET)
diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c
index 9fcc3c9ce..ad3e24fc8 100755
--- a/formats/format_wav_gsm.c
+++ b/formats/format_wav_gsm.c
@@ -51,7 +51,6 @@ struct ast_filestream {
weird MS format */
/* This is what a filestream means to us */
int fd; /* Descriptor */
- int bytes;
struct ast_frame fr; /* Frame information */
char waste[AST_FRIENDLY_OFFSET]; /* Buffer for sending frames, etc */
char empty; /* Empty character */
@@ -219,7 +218,7 @@ static int update_header(int fd)
end = lseek(fd, 0, SEEK_END);
/* in a gsm WAV, data starts 60 bytes in */
bytes = end - 60;
- datalen = htoll(bytes);
+ datalen = htoll((bytes + 1) & ~0x1);
filelen = htoll(52 + ((bytes + 1) & ~0x1));
if (cur < 0) {
ast_log(LOG_WARNING, "Unable to find our position\n");
@@ -398,7 +397,7 @@ static void wav_close(struct ast_filestream *s)
ast_mutex_unlock(&wav_lock);
ast_update_use_count();
/* Pad to even length */
- if (s->bytes & 0x1)
+ if (lseek(s->fd, 0, SEEK_END) & 0x1)
write(s->fd, &zero, 1);
close(s->fd);
free(s);
@@ -458,7 +457,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));
return -1;
}
- fs->bytes += 65;
update_header(fs->fd);
len += 65;
} else {
@@ -469,7 +467,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));
return -1;
}
- fs->bytes += 65;
update_header(fs->fd);
} else {
/* Copy the data and do nothing */