[asterisk-commits] kmoore: branch 10 r349732 - in /branches/10: ./ main/file.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 5 16:10:48 CST 2012
Author: kmoore
Date: Thu Jan 5 16:10:45 2012
New Revision: 349732
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=349732
Log:
Allow playback of formats that don't support seeking
ast_streamfile previously did unconditional seeking on files that broke
playback of formats that don't support that functionality. This patch avoids
the seek that was causing the problem. This regression was introduced in
r158062.
(closes issue ASTERISK-18994)
Patch-by: Timo Teras
........
Merged revisions 349731 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/10/ (props changed)
branches/10/main/file.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/main/file.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/file.c?view=diff&rev=349732&r1=349731&r2=349732
==============================================================================
--- branches/10/main/file.c (original)
+++ branches/10/main/file.c Thu Jan 5 16:10:45 2012
@@ -1012,6 +1012,7 @@
struct ast_filestream *fs;
struct ast_filestream *vfs=NULL;
char fmt[256];
+ off_t pos;
int seekattempt;
int res;
@@ -1024,12 +1025,17 @@
/* check to see if there is any data present (not a zero length file),
* done this way because there is no where for ast_openstream_full to
* return the file had no data. */
- seekattempt = fseek(fs->f, -1, SEEK_END);
- if (seekattempt && errno == EINVAL) {
- /* Zero-length file, as opposed to a pipe */
- return 0;
+ pos = ftello(fs->f);
+ seekattempt = fseeko(fs->f, -1, SEEK_END);
+ if (seekattempt) {
+ if (errno == EINVAL) {
+ /* Zero-length file, as opposed to a pipe */
+ return 0;
+ } else {
+ ast_seekstream(fs, 0, SEEK_SET);
+ }
} else {
- ast_seekstream(fs, 0, SEEK_SET);
+ fseeko(fs->f, pos, SEEK_SET);
}
vfs = ast_openvstream(chan, filename, preflang);
More information about the asterisk-commits
mailing list