]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only log a failure to get read/write samples from factories if it didn't happen
authorMatthew Jordan <mjordan@digium.com>
Wed, 2 May 2012 02:44:15 +0000 (02:44 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 2 May 2012 02:44:15 +0000 (02:44 +0000)
In audiohook_read_frame_both, anytime samples are obtained from the read/write
factories a debug statement is logged stating that samples were not obtained
from the factories.  This statement used to only occur if option_debug was
turned on and no samples were obtained; in some refactoring when the
option_debug statement was removed, the "else" clause was removed as well.

This patch makes it so that those debug log statements only occur if the
condition leading up to them actually happened.

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

main/audiohook.c

index 83fec318fbcf9a638fe1f8201289b9b71d221a9d..2ed9b27d1dcefe5cdb635bb8c6acf826f7df0b59 100644 (file)
@@ -288,8 +288,9 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho
                                }
                        }
                }
+       } else {
+               ast_debug(1, "Failed to get %d samples from read factory %p\n", (int)samples, &audiohook->read_factory);
        }
-       ast_debug(1, "Failed to get %d samples from read factory %p\n", (int)samples, &audiohook->read_factory);
 
        /* Move on to the write factory... if there are enough samples, read them in */
        if (usable_write) {
@@ -307,8 +308,9 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho
                                }
                        }
                }
+       } else {
+               ast_debug(1, "Failed to get %d samples from write factory %p\n", (int)samples, &audiohook->write_factory);
        }
-       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 && read_reference) {