diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-03 07:49:05 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-03 07:49:05 +0000 |
commit | 8f48eef808be055a22ed8b378c0e337a15b1f041 (patch) | |
tree | b0fefba24c2a34bdde2fdd9b0d52a113371a25ed /main/file.c | |
parent | 5fc7941629716375b509232d64fa0cdf6aa026ef (diff) |
Use a 32k file buffer on recordings, which increases the efficiency of file recording.
(closes issue #11962)
Reported by: garlew
Patches:
recording.patch uploaded by garlew (license 376)
bug-11962.diff uploaded by snuffy (license 35)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@112564 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/file.c')
-rw-r--r-- | main/file.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/main/file.c b/main/file.c index 73387a2ff..e34020ed8 100644 --- a/main/file.c +++ b/main/file.c @@ -817,17 +817,22 @@ int ast_closestream(struct ast_filestream *f) ast_safe_system(cmd); } + if (f->fmt->close) { + f->fmt->close(f); + } if (f->filename) ast_free(f->filename); if (f->realfilename) ast_free(f->realfilename); - if (f->fmt->close) - f->fmt->close(f); fclose(f->f); if (f->vfs) ast_closestream(f->vfs); if (f->orig_chan_name) free((void *) f->orig_chan_name); + if (f->write_buffer) { + ast_free(f->write_buffer); + } + ast_module_unref(f->fmt->module); ast_free(f); return 0; @@ -1051,6 +1056,11 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con } fs->vfs = NULL; /* If truncated, we'll be at the beginning; if not truncated, then append */ + + if ((fs->write_buffer = ast_malloc(32768))){ + setvbuf(fs->f, fs->write_buffer, _IOFBF, 32768); + } + f->seek(fs, 0, SEEK_END); } else if (errno != EEXIST) { ast_log(LOG_WARNING, "Unable to open file %s: %s\n", fn, strerror(errno)); |