[asterisk-commits] tilghman: branch 1.4 r219653 - /branches/1.4/main/file.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Sep 20 12:52:12 CDT 2009


Author: tilghman
Date: Sun Sep 20 12:52:05 2009
New Revision: 219653

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=219653
Log:
Really stop the stream, when ast_closestream() is called.
(closes issue #15129)
 Reported by: bmh
 Patches: 
       20090918__issue15129.diff.txt uploaded by tilghman (license 14)
 Review:
       https://reviewboard.asterisk.org/r/372/

Modified:
    branches/1.4/main/file.c

Modified: branches/1.4/main/file.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/file.c?view=diff&rev=219653&r1=219652&r2=219653
==============================================================================
--- branches/1.4/main/file.c (original)
+++ branches/1.4/main/file.c Sun Sep 20 12:52:05 2009
@@ -890,6 +890,22 @@
 
 int ast_closestream(struct ast_filestream *f)
 {
+	/* This used to destroy the filestream, but it now just decrements a refcount.
+	 * We need to force the stream to quit queuing frames now, because we might
+	 * change the writeformat, which could result in a subsequent write error, if
+	 * the format is different. */
+
+	/* Stop a running stream if there is one */
+	if (f->owner) {
+		if (f->fmt->format < AST_FORMAT_AUDIO_MASK) {
+			f->owner->stream = NULL;
+			AST_SCHED_DEL(f->owner->sched, f->owner->streamid);
+			ast_settimeout(f->owner, 0, NULL, NULL);
+		} else {
+			f->owner->vstream = NULL;
+			AST_SCHED_DEL(f->owner->sched, f->owner->vstreamid);
+		}
+	}
 
 	if (ast_test_flag(&f->fr, AST_FRFLAG_FROM_FILESTREAM)) {
 		/* If this flag is still set, it essentially means that the reference




More information about the asterisk-commits mailing list