aboutsummaryrefslogtreecommitdiffstats
path: root/main/slinfactory.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-08 15:03:43 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-08 15:03:43 +0000
commit519910e84219b480c9d09fdf75560b14b03c4dc9 (patch)
tree17ca8b74acee8df257b708862d0213df621a109f /main/slinfactory.c
parent854db8a3ba6b65929bb6482a9a52b494f41a2cc4 (diff)
If audio suddenly gets fed into one side of a channel after a lapse of frames flush the other factory so that old audio does not remain in the factory causing the sync code to not execute.
(closes issue #12296) Reported by: jvandal git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@113296 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/slinfactory.c')
-rw-r--r--main/slinfactory.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/main/slinfactory.c b/main/slinfactory.c
index 0022c62de..bd5b8de4f 100644
--- a/main/slinfactory.c
+++ b/main/slinfactory.c
@@ -157,3 +157,21 @@ unsigned int ast_slinfactory_available(const struct ast_slinfactory *sf)
{
return sf->size;
}
+
+void ast_slinfactory_flush(struct ast_slinfactory *sf)
+{
+ struct ast_frame *fr = NULL;
+
+ if (sf->trans) {
+ ast_translator_free_path(sf->trans);
+ sf->trans = NULL;
+ }
+
+ while ((fr = AST_LIST_REMOVE_HEAD(&sf->queue, frame_list)))
+ ast_frfree(fr);
+
+ sf->size = sf->holdlen = 0;
+ sf->offset = sf->hold;
+
+ return;
+}