diff options
author | Joshua Colp <jcolp@digium.com> | 2016-12-01 10:38:34 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-12-01 10:38:34 -0600 |
commit | bddc60df731876b7f6c95344a50c62dd78ef246a (patch) | |
tree | ecbdffac240ced3cc8a31e765e2f51a998805a85 /main/channel.c | |
parent | 662a4741e2e2497dcb7d5a6098435f04967796c5 (diff) | |
parent | 17b0b91afa1aa6b8b503a75e96b054f13612356a (diff) |
Merge "Frame deferral: Re-queue deferred frames one-at-a-time." into 13
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/main/channel.c b/main/channel.c index ac99dd6a2..6083dcc4a 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1069,16 +1069,15 @@ void ast_channel_start_defer_frames(struct ast_channel *chan, int defer_hangups) void ast_channel_stop_defer_frames(struct ast_channel *chan) { + struct ast_frame *f; + ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DEFER_FRAMES); /* Move the deferred frames onto the channel read queue, ahead of other queued frames */ - ast_queue_frame_head(chan, AST_LIST_FIRST(ast_channel_deferred_readq(chan))); - /* ast_frfree will mosey down the list and free them all */ - if (!AST_LIST_EMPTY(ast_channel_deferred_readq(chan))) { - ast_frfree(AST_LIST_FIRST(ast_channel_deferred_readq(chan))); + while ((f = AST_LIST_REMOVE_HEAD(ast_channel_deferred_readq(chan), frame_list))) { + ast_queue_frame_head(chan, f); + ast_frfree(f); } - /* Reset the list to be empty */ - AST_LIST_HEAD_INIT_NOLOCK(ast_channel_deferred_readq(chan)); } static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int head, struct ast_frame *after) @@ -3903,10 +3902,10 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio) struct ast_frame *dup; dup = ast_frdup(f); - AST_LIST_INSERT_TAIL(ast_channel_deferred_readq(chan), dup, frame_list); + AST_LIST_INSERT_HEAD(ast_channel_deferred_readq(chan), dup, frame_list); } } else { - AST_LIST_INSERT_TAIL(ast_channel_deferred_readq(chan), f, frame_list); + AST_LIST_INSERT_HEAD(ast_channel_deferred_readq(chan), f, frame_list); AST_LIST_REMOVE_CURRENT(frame_list); } } |