aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-20 17:52:05 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-20 17:52:05 +0000
commit44d68a8c071469ec20668f0727ab8f9c212c2e43 (patch)
treed1033d79398f84b27a532f48910bcfb2992b1554 /main
parent6f7784dccab8336b280702a6dc9ea48970dba07d (diff)
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/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@219653 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/file.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/main/file.c b/main/file.c
index f39268fe3..d110d72f9 100644
--- a/main/file.c
+++ b/main/file.c
@@ -890,6 +890,22 @@ int ast_stream_rewind(struct ast_filestream *fs, off_t ms)
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