]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Allow streaming audio from a pipe.
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 6 Oct 2010 13:48:27 +0000 (13:48 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 6 Oct 2010 13:48:27 +0000 (13:48 +0000)
(closes issue #18001)
 Reported by: jamicque
 Patches:
       20100926__issue18001.diff.txt uploaded by tilghman (license 14)
 Tested by: jamicque

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@290575 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/file.c

index ae67f8bc95cdd35e1bacfe6c2279ba53d9786446..20cda4929e9a29ccbf02057ae637a0e184d81780 100644 (file)
@@ -961,10 +961,12 @@ int ast_streamfile(struct ast_channel *chan, const char *filename, const char *p
         * 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)
-               ast_seekstream(fs, 0, SEEK_SET);
-       else
+       if (seekattempt && errno == EINVAL) {
+               /* Zero-length file, as opposed to a pipe */
                return 0;
+       } else {
+               ast_seekstream(fs, 0, SEEK_SET);
+       }
 
        vfs = ast_openvstream(chan, filename, preflang);
        if (vfs) {