[asterisk-commits] Revert "Revert "channel: Use frame deferral API for safe sle... (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Nov 16 15:39:00 CST 2016
Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4421 )
Change subject: Revert "Revert "channel: Use frame deferral API for safe sleep.""
......................................................................
Revert "Revert "channel: Use frame deferral API for safe sleep.""
This reverts commit 58c88cfbaa80cb43419cde9186d643d1c5d24baf.
Change-Id: I72692e2b2e83ef6da9390075ff20b138b2c374b6
---
M main/channel.c
1 file changed, 6 insertions(+), 27 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Mark Michelson: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/main/channel.c b/main/channel.c
index 98359ba..020d4d0 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1543,19 +1543,18 @@
int res = 0;
struct timeval start;
int ms;
- AST_LIST_HEAD_NOLOCK(, ast_frame) deferred_frames;
-
- AST_LIST_HEAD_INIT_NOLOCK(&deferred_frames);
/* If no other generator is present, start silencegen while waiting */
if (ast_opt_transmit_silence && !ast_channel_generatordata(chan)) {
silgen = ast_channel_start_silence_generator(chan);
}
+ ast_channel_lock(chan);
+ ast_channel_start_defer_frames(chan);
+ ast_channel_unlock(chan);
+
start = ast_tvnow();
while ((ms = ast_remaining_ms(start, timeout_ms))) {
- struct ast_frame *dup_f = NULL;
-
if (cond && ((*cond)(data) == 0)) {
break;
}
@@ -1570,18 +1569,7 @@
res = -1;
break;
}
-
- if (!ast_is_deferrable_frame(f)) {
- ast_frfree(f);
- continue;
- }
-
- if ((dup_f = ast_frisolate(f))) {
- if (dup_f != f) {
- ast_frfree(f);
- }
- AST_LIST_INSERT_HEAD(&deferred_frames, dup_f, frame_list);
- }
+ ast_frfree(f);
}
}
@@ -1590,17 +1578,8 @@
ast_channel_stop_silence_generator(chan, silgen);
}
- /* We need to free all the deferred frames, but we only need to
- * queue the deferred frames if there was no error and no
- * hangup was received
- */
ast_channel_lock(chan);
- while ((f = AST_LIST_REMOVE_HEAD(&deferred_frames, frame_list))) {
- if (!res) {
- ast_queue_frame_head(chan, f);
- }
- ast_frfree(f);
- }
+ ast_channel_stop_defer_frames(chan);
ast_channel_unlock(chan);
return res;
--
To view, visit https://gerrit.asterisk.org/4421
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I72692e2b2e83ef6da9390075ff20b138b2c374b6
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-commits
mailing list