summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-04-28 17:45:57 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-04-28 17:45:57 -0500
commitd53d494f0b89e14766b433565c3363078607e1ef (patch)
treefeecec8ad7f9853777896ef69c2c62f8b6c6290c /main
parent057ed94048b591a74322bbdb152e65f567091518 (diff)
parent72817707104f1d564c75be5ecd9aa0ce01f38589 (diff)
Merge "app_chanspy: reduce audio loss on the spying channel."
Diffstat (limited to 'main')
-rw-r--r--main/audiohook.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/audiohook.c b/main/audiohook.c
index e3089131e..4a73fbd52 100644
--- a/main/audiohook.c
+++ b/main/audiohook.c
@@ -45,6 +45,7 @@ ASTERISK_REGISTER_FILE()
#define AST_AUDIOHOOK_SYNC_TOLERANCE 100 /*!< Tolerance in milliseconds for audiohooks synchronization */
#define AST_AUDIOHOOK_SMALL_QUEUE_TOLERANCE 100 /*!< When small queue is enabled, this is the maximum amount of audio that can remain queued at a time. */
+#define AST_AUDIOHOOK_LONG_QUEUE_TOLERANCE 500 /*!< Otheriwise we still don't want the queue to grow indefinitely */
#define DEFAULT_INTERNAL_SAMPLE_RATE 8000
@@ -192,6 +193,10 @@ int ast_audiohook_write_frame(struct ast_audiohook *audiohook, enum ast_audiohoo
ast_debug(1, "Audiohook %p has stale audio in its factories. Flushing them both\n", audiohook);
ast_slinfactory_flush(factory);
ast_slinfactory_flush(other_factory);
+ } else if ((our_factory_ms > AST_AUDIOHOOK_LONG_QUEUE_TOLERANCE) || (other_factory_ms > AST_AUDIOHOOK_LONG_QUEUE_TOLERANCE)) {
+ ast_debug(1, "Audiohook %p has stale audio in its factories. Flushing them both\n", audiohook);
+ ast_slinfactory_flush(factory);
+ ast_slinfactory_flush(other_factory);
}
/* swap frame data for zeros if mute is required */