[asterisk-commits] oej: branch oej/silence-detection-games-1.8 r411920 - /team/oej/silence-detec...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 8 08:47:59 CDT 2014


Author: oej
Date: Tue Apr  8 08:47:52 2014
New Revision: 411920

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411920
Log:
Trying to manipulate audiohooks to return &ast_null_frame

Modified:
    team/oej/silence-detection-games-1.8/main/audiohook.c
    team/oej/silence-detection-games-1.8/main/silencedetection.c

Modified: team/oej/silence-detection-games-1.8/main/audiohook.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/silence-detection-games-1.8/main/audiohook.c?view=diff&rev=411920&r1=411919&r2=411920
==============================================================================
--- team/oej/silence-detection-games-1.8/main/audiohook.c (original)
+++ team/oej/silence-detection-games-1.8/main/audiohook.c Tue Apr  8 08:47:52 2014
@@ -632,6 +632,7 @@
 	struct ast_frame *start_frame = frame, *middle_frame = frame, *end_frame = frame;
 	struct ast_audiohook *audiohook = NULL;
 	int samples = frame->samples;
+	int needsdrop = 0;
 
 	/* ---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 */
@@ -711,12 +712,22 @@
 				 * be taken here to exit early. */
 			}
 			ast_audiohook_unlock(audiohook);
+			if (middle_frame->frametype == AST_FRAME_DROP) {
+				/* This frame is going nowhere after this */
+				needsdrop = 1;
+			}
 		}
 		AST_LIST_TRAVERSE_SAFE_END;
 		end_frame = middle_frame;
 	}
 
 	/* ---Part_3: Decide what to do with the end_frame (whether to transcode or not) */
+	if (needsdrop) {
+		/* The frame needs to go away badly */
+		ast_frfree(middle_frame);
+		return &ast_null_frame;
+	}
+
 	if (middle_frame == end_frame) {
 		/* Middle frame was modified and became the end frame... let's see if we need to transcode */
 		if (end_frame->subclass.codec != start_frame->subclass.codec) {

Modified: team/oej/silence-detection-games-1.8/main/silencedetection.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/silence-detection-games-1.8/main/silencedetection.c?view=diff&rev=411920&r1=411919&r2=411920
==============================================================================
--- team/oej/silence-detection-games-1.8/main/silencedetection.c (original)
+++ team/oej/silence-detection-games-1.8/main/silencedetection.c Tue Apr  8 08:47:52 2014
@@ -155,7 +155,7 @@
         				frame->samples = 0;
 					frame->datalen = 0;
 					
-					//frame->frametype = AST_FRAME_DROP;
+					frame->frametype = AST_FRAME_DROP;
 					ast_channel_unlock(chan);
 					return 0;	/* Return TRUE since we manipulated the frame */
 				}




More information about the asterisk-commits mailing list