diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2009-09-20 17:55:49 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2009-09-20 17:55:49 +0000 |
commit | 07f9778f5bb196c94103160809cedad04c2736eb (patch) | |
tree | c3d3aa7194372adaed177fec9a87c7408ece840e /main/file.c | |
parent | 5996ab0ee2a99e41320543eb2f66982fb90ed8f9 (diff) |
Merged revisions 219653 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r219653 | tilghman | 2009-09-20 12:52:05 -0500 (Sun, 20 Sep 2009) | 8 lines
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: https://origsvn.digium.com/svn/asterisk/trunk@219654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/file.c')
-rw-r--r-- | main/file.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/main/file.c b/main/file.c index c66742f72..5855f4522 100644 --- a/main/file.c +++ b/main/file.c @@ -865,6 +865,23 @@ 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 * count of f is non-zero. We can't destroy this filestream until |