[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase2 r308240 - /team/dvossel/fixtheworl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 17 17:21:57 CST 2011


Author: dvossel
Date: Thu Feb 17 17:21:54 2011
New Revision: 308240

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=308240
Log:
Addresses issues I've found during review

Modified:
    team/dvossel/fixtheworld_phase2/main/audiohook.c
    team/dvossel/fixtheworld_phase2/main/format.c

Modified: team/dvossel/fixtheworld_phase2/main/audiohook.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/audiohook.c?view=diff&rev=308240&r1=308239&r2=308240
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/audiohook.c (original)
+++ team/dvossel/fixtheworld_phase2/main/audiohook.c Thu Feb 17 17:21:54 2011
@@ -732,15 +732,9 @@
  *         SLINEAR format for Part_2.
  * Part_2: Send middle_frame off to spies and manipulators.  At this point middle_frame is
  *         either a new frame as result of the translation, or points directly to the start_frame
- *         because no translation to SLINEAR audio was required.  The result of this part
- *         is end_frame will be updated to point to middle_frame if any audiohook manipulation
- *         took place.
- * Part_3: Translate end_frame's audio back into the format of start frame if necessary.
- *         At this point if middle_frame != end_frame, we are guaranteed that no manipulation
- *         took place and middle_frame can be freed as it was translated... If middle_frame was
- *         not translated and still pointed to start_frame, it would be equal to end_frame as well
- *         regardless if manipulation took place which would not result in this free.  The result
- *         of this part is end_frame is guaranteed to be the format of start_frame for the return.
+ *         because no translation to SLINEAR audio was required.
+ * Part_3: Translate end_frame's audio back into the format of start frame if necessary.  This
+ *         is only necessary if manipulation of middle_frame occurred.
  *         
  * \param chan Channel that the list is coming off of
  * \param audiohook_list List of audiohooks
@@ -757,7 +751,7 @@
 	int removed = 0;
 
 	/* ---Part_1. translate start_frame to SLINEAR if necessary. */
-	if (!(middle_frame = audiohook_list_translate_to_slin(audiohook_list, direction, frame))) {
+	if (!(middle_frame = audiohook_list_translate_to_slin(audiohook_list, direction, start_frame))) {
 		return frame;
 	}
 	samples = middle_frame->samples;
@@ -837,7 +831,6 @@
 		middle_frame_manipulated = 1;
 	}
 
-
 	/* ---Part_3: Decide what to do with the end_frame (whether to transcode or not) */
 	if (middle_frame_manipulated) {
 		if (!(end_frame = audiohook_list_translate_to_native(audiohook_list, direction, middle_frame, &start_frame->subclass.format))) {
@@ -850,6 +843,7 @@
 	/* clean up our middle_frame if required */
 	if (middle_frame != end_frame) {
 		ast_frfree(middle_frame);
+		middle_frame = NULL;
 	}
 
 	/* Before returning, if an audiohook got removed, reset samplerate compatibility */

Modified: team/dvossel/fixtheworld_phase2/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/format.c?view=diff&rev=308240&r1=308239&r2=308240
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/format.c (original)
+++ team/dvossel/fixtheworld_phase2/main/format.c Thu Feb 17 17:21:54 2011
@@ -938,9 +938,11 @@
 		ao2_ref(tmp, -1);
 	}
 
+	/* walk through the container adding elements to the static array */
 	it = ao2_iterator_init(format_list, 0);
 	while ((tmp = ao2_iterator_next(&it)) && (i < format_list_array_len)) {
 		memcpy(&format_list_array[i], tmp, sizeof(struct ast_format_list));
+		ao2_ref(tmp, -1);
 		i++;
 	}
 	ao2_iterator_destroy(&it);




More information about the asterisk-commits mailing list