[asterisk-commits] jrose: trunk r310547 - /trunk/main/audiohook.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 14 08:12:56 CDT 2011
Author: jrose
Date: Mon Mar 14 08:12:51 2011
New Revision: 310547
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310547
Log:
Fixes null reference bug introduced by audio hook changes that affects various OS distributions. Thanks David.
Modified:
trunk/main/audiohook.c
Modified: trunk/main/audiohook.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/audiohook.c?view=diff&rev=310547&r1=310546&r2=310547
==============================================================================
--- trunk/main/audiohook.c (original)
+++ trunk/main/audiohook.c Mon Mar 14 08:12:51 2011
@@ -311,25 +311,26 @@
ast_debug(1, "Failed to get %d samples from write factory %p\n", (int)samples, &audiohook->write_factory);
/* Basically we figure out which buffer to use... and if mixing can be done here */
- if (!read_buf && !write_buf)
+ if (read_buf && read_reference) {
+ frame.data.ptr = buf1;
+ *read_reference = ast_frdup(&frame);
+ }
+ if (write_buf && write_reference) {
+ frame.data.ptr = buf2;
+ *write_reference = ast_frdup(&frame);
+ }
+
+ if (read_buf && write_buf) {
+ for (i = 0, data1 = read_buf, data2 = write_buf; i < samples; i++, data1++, data2++) {
+ ast_slinear_saturated_add(data1, data2);
+ }
+ final_buf = buf1;
+ } else if (read_buf) {
+ final_buf = buf1;
+ } else if (write_buf) {
+ final_buf = buf2;
+ } else {
return NULL;
-
- if (read_buf) {
- final_buf = buf1;
- frame.data.ptr = final_buf;
- *read_reference = ast_frdup(&frame);
- }
-
- if (write_buf) {
- final_buf = buf2;
- frame.data.ptr = final_buf;
- *write_reference = ast_frdup(&frame);
- }
-
- if (read_buf && write_buf) {
- for (i = 0, data1 = read_buf, data2 = write_buf; i < samples; i++, data1++, data2++)
- ast_slinear_saturated_add(data1, data2);
- final_buf = buf1;
}
/* Make the final buffer part of the frame, so it gets duplicated fine */
More information about the asterisk-commits
mailing list