]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Really stop the stream, when ast_closestream() is called.
authorTilghman Lesher <tilghman@meg.abyt.es>
Sun, 20 Sep 2009 17:52:05 +0000 (17:52 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Sun, 20 Sep 2009 17:52:05 +0000 (17:52 +0000)
(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: https://origsvn.digium.com/svn/asterisk/branches/1.4@219653 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/file.c

index f39268fe370eb0b8f544d84ef5b15ca129f1bd3b..d110d72f9c16b632093fe76844dcc0c30a7367be 100644 (file)
@@ -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