[svn-commits] dvossel: branch 1.6.2 r279946 - in /branches/1.6.2: ./ include/asterisk/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 27 15:54:37 CDT 2010


Author: dvossel
Date: Tue Jul 27 15:54:32 2010
New Revision: 279946

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=279946
Log:
Merged revisions 279945 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r279945 | dvossel | 2010-07-27 15:33:40 -0500 (Tue, 27 Jul 2010) | 19 lines
  
  remove empty audiohook write list on channel
  
  If a channel has an audiohook write list created on it, that
  list stays on the channel until the channel is destroyed.  There
  is no reason to keep that list on the channel if it becomes empty.
  If it is empty that just means we are doing needless translating
  for every ast_read and ast_write.  This patch removes the audiohook
  list from the channel once it is detected to be empty on either a
  read or write.  If a audiohook is added back to the channel after
  this list is destroyed, the list just gets recreated as if it never
  existed to begin with.
  
  (closes issue #17630)
  Reported by: manvirr
  
  Review: https://reviewboard.asterisk.org/r/799/
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/include/asterisk/audiohook.h
    branches/1.6.2/main/audiohook.c
    branches/1.6.2/main/channel.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Tue Jul 27 15:54:32 2010
@@ -1,1 +1,1 @@
-/branches/1.4:1-279056,279206
+/branches/1.4:1-279056,279206,279945

Modified: branches/1.6.2/include/asterisk/audiohook.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/include/asterisk/audiohook.h?view=diff&rev=279946&r1=279945&r2=279946
==============================================================================
--- branches/1.6.2/include/asterisk/audiohook.h (original)
+++ branches/1.6.2/include/asterisk/audiohook.h Tue Jul 27 15:54:32 2010
@@ -200,6 +200,13 @@
  */
 int ast_audiohook_remove(struct ast_channel *chan, struct ast_audiohook *audiohook);
 
+/*!
+ * \brief determines if a audiohook_list is empty or not.
+ *
+ * retval 0 false, 1 true
+ */
+int ast_audiohook_write_list_empty(struct ast_audiohook_list *audiohook_list);
+
 /*! \brief Pass a frame off to be handled by the audiohook core
  * \param chan Channel that the list is coming off of
  * \param audiohook_list List of audiohooks

Modified: branches/1.6.2/main/audiohook.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/audiohook.c?view=diff&rev=279946&r1=279945&r2=279946
==============================================================================
--- branches/1.6.2/main/audiohook.c (original)
+++ branches/1.6.2/main/audiohook.c Tue Jul 27 15:54:32 2010
@@ -723,6 +723,17 @@
 	return end_frame;
 }
 
+int ast_audiohook_write_list_empty(struct ast_audiohook_list *audiohook_list)
+{
+	if (AST_LIST_EMPTY(&audiohook_list->spy_list) &&
+		AST_LIST_EMPTY(&audiohook_list->whisper_list) &&
+		AST_LIST_EMPTY(&audiohook_list->manipulate_list)) {
+
+		return 1;
+	}
+	return 0;
+}
+
 /*! \brief Pass a frame off to be handled by the audiohook core
  * \param chan Channel that the list is coming off of
  * \param audiohook_list List of audiohooks
@@ -740,7 +751,6 @@
 	else
 		return frame;
 }
-			
 
 /*! \brief Wait for audiohook trigger to be triggered
  * \param audiohook Audiohook to wait on

Modified: branches/1.6.2/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/channel.c?view=diff&rev=279946&r1=279945&r2=279946
==============================================================================
--- branches/1.6.2/main/channel.c (original)
+++ branches/1.6.2/main/channel.c Tue Jul 27 15:54:32 2010
@@ -3162,6 +3162,11 @@
 	if (chan->music_state && chan->generator && chan->generator->digit && f && f->frametype == AST_FRAME_DTMF_END)
 		chan->generator->digit(chan, f->subclass);
 
+	if (chan->audiohooks && ast_audiohook_write_list_empty(chan->audiohooks)) {
+		/* The list gets recreated if audiohooks are added again later */
+		ast_audiohook_detach_list(chan->audiohooks);
+		chan->audiohooks = NULL;
+	}
 	ast_channel_unlock(chan);
 	return f;
 }
@@ -3851,6 +3856,11 @@
 		chan->fout = FRAMECOUNT_INC(chan->fout);
 	}
 done:
+	if (chan->audiohooks && ast_audiohook_write_list_empty(chan->audiohooks)) {
+		/* The list gets recreated if audiohooks are added again later */
+		ast_audiohook_detach_list(chan->audiohooks);
+		chan->audiohooks = NULL;
+	}
 	ast_channel_unlock(chan);
 	return res;
 }




More information about the svn-commits mailing list