mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-21 09:10:36 +00:00
Minor fixes to playback logic
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1134 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
18
file.c
18
file.c
@@ -601,12 +601,13 @@ int ast_closestream(struct ast_filestream *f)
|
|||||||
{
|
{
|
||||||
/* Stop a running stream if there is one */
|
/* Stop a running stream if there is one */
|
||||||
if (f->owner) {
|
if (f->owner) {
|
||||||
f->owner->stream = NULL;
|
|
||||||
if (f->fmt->format < AST_FORMAT_MAX_AUDIO) {
|
if (f->fmt->format < AST_FORMAT_MAX_AUDIO) {
|
||||||
|
f->owner->stream = NULL;
|
||||||
if (f->owner->streamid > -1)
|
if (f->owner->streamid > -1)
|
||||||
ast_sched_del(f->owner->sched, f->owner->streamid);
|
ast_sched_del(f->owner->sched, f->owner->streamid);
|
||||||
f->owner->streamid = -1;
|
f->owner->streamid = -1;
|
||||||
} else {
|
} else {
|
||||||
|
f->owner->vstream = NULL;
|
||||||
if (f->owner->vstreamid > -1)
|
if (f->owner->vstreamid > -1)
|
||||||
ast_sched_del(f->owner->sched, f->owner->vstreamid);
|
ast_sched_del(f->owner->sched, f->owner->vstreamid);
|
||||||
f->owner->vstreamid = -1;
|
f->owner->vstreamid = -1;
|
||||||
@@ -766,7 +767,10 @@ char ast_waitstream(struct ast_channel *c, char *breakon)
|
|||||||
while(c->stream) {
|
while(c->stream) {
|
||||||
res = ast_sched_wait(c->sched);
|
res = ast_sched_wait(c->sched);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_closestream(c->stream);
|
if (c->stream)
|
||||||
|
ast_closestream(c->stream);
|
||||||
|
if (c->vstream)
|
||||||
|
ast_closestream(c->vstream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Setup timeout if supported */
|
/* Setup timeout if supported */
|
||||||
@@ -822,7 +826,10 @@ char ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char
|
|||||||
while(c->stream) {
|
while(c->stream) {
|
||||||
res = ast_sched_wait(c->sched);
|
res = ast_sched_wait(c->sched);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_closestream(c->stream);
|
if (c->stream)
|
||||||
|
ast_closestream(c->stream);
|
||||||
|
if (c->vstream)
|
||||||
|
ast_closestream(c->vstream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ast_settimeout(c, res);
|
ast_settimeout(c, res);
|
||||||
@@ -886,7 +893,10 @@ char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int
|
|||||||
while(c->stream) {
|
while(c->stream) {
|
||||||
ms = ast_sched_wait(c->sched);
|
ms = ast_sched_wait(c->sched);
|
||||||
if (ms < 0) {
|
if (ms < 0) {
|
||||||
ast_closestream(c->stream);
|
if (c->stream)
|
||||||
|
ast_closestream(c->stream);
|
||||||
|
if (c->vstream)
|
||||||
|
ast_closestream(c->vstream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ast_settimeout(c, ms);
|
ast_settimeout(c, ms);
|
||||||
|
|||||||
Reference in New Issue
Block a user