[asterisk-commits] jpeeler: branch 1.6.1 r158069 - in /branches/1.6.1: ./ main/file.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 20 11:42:33 CST 2008


Author: jpeeler
Date: Thu Nov 20 11:42:32 2008
New Revision: 158069

URL: http://svn.digium.com/view/asterisk?view=rev&rev=158069
Log:
Merged revisions 158062 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r158062 | jpeeler | 2008-11-20 11:37:31 -0600 (Thu, 20 Nov 2008) | 6 lines

(closes issue #12929)
Reported by: snyfer

This handles the case for a zero length file to attempt to be streamed. Instead of failing from not playing any data, go ahead and return success as ast_streamfile should consider playing nothing a success when there is nothing to play.


........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/main/file.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/main/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/main/file.c?view=diff&rev=158069&r1=158068&r2=158069
==============================================================================
--- branches/1.6.1/main/file.c (original)
+++ branches/1.6.1/main/file.c Thu Nov 20 11:42:32 2008
@@ -407,6 +407,9 @@
 					ast_free(s);
 					continue;	/* cannot run open on file */
 				}
+				if (st.st_size == 0) {
+					ast_log(LOG_WARNING, "File %s detected to have zero size.\n", fn);
+				}
 				/* ok this is good for OPEN */
 				res = 1;	/* found */
 				s->lasttimeout = -1;
@@ -872,8 +875,19 @@
 	struct ast_filestream *fs;
 	struct ast_filestream *vfs=NULL;
 	char fmt[256];
+	int seekattempt;
 
 	fs = ast_openstream(chan, filename, preflang);
+
+	/* 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)
+		fseek(fs->f, 0, SEEK_SET);
+	else
+		return 0;
+
 	if (fs)
 		vfs = ast_openvstream(chan, filename, preflang);
 	if (vfs) {




More information about the asterisk-commits mailing list