]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Once an audiohook is attached to a channel, we continue to transcode all of the
authorSean Bright <sean@malleable.com>
Tue, 27 Dec 2011 17:09:14 +0000 (17:09 +0000)
committerSean Bright <sean@malleable.com>
Tue, 27 Dec 2011 17:09:14 +0000 (17:09 +0000)
frames, even after all of the hooks are detached.  This patch short-cicuits us
out before we transcode unnecessarily.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@349144 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/audiohook.c

index 7509321162bc8c0c79e09321c600716175beb86e..0ec8adaeacfff995a91129a4b241cbe6f40b8f4e 100644 (file)
@@ -621,6 +621,12 @@ static struct ast_frame *audio_audiohook_write_list(struct ast_channel *chan, st
        struct ast_audiohook *audiohook = NULL;
        int samples = frame->samples;
 
+       /* Don't translate our frame if we aren't going to bother to use it */
+       if (AST_LIST_EMPTY(&audiohook_list->spy_list)
+               && AST_LIST_EMPTY(&audiohook_list->whisper_list)
+               && AST_LIST_EMPTY(&audiohook_list->manipulate_list))
+               return end_frame;
+
        /* ---Part_1. translate start_frame to SLINEAR if necessary. */
        /* If the frame coming in is not signed linear we have to send it through the in_translate path */
        if (frame->subclass.codec != AST_FORMAT_SLINEAR) {