]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add a small tweak to the code that checks to see whether destination formats
authorRussell Bryant <russell@russellbryant.com>
Tue, 31 Oct 2006 05:55:07 +0000 (05:55 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 31 Oct 2006 05:55:07 +0000 (05:55 +0000)
are translatable based on the source format.  If we have already determined
that there is no translation path in one direction, don't bother checking the
other direction.

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

main/translate.c

index f3918d9d20cd5c8f2b2cfa746b4cbd3815b821f9..c7172619bc5ae3a40749bb9e113aba380c64b34f 100644 (file)
@@ -855,13 +855,14 @@ unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src
 
                /* if we don't have a translation path from the src
                   to this format, remove it from the result */
-               if (!tr_matrix[src_audio][powerof(x)].step)
+               if (!tr_matrix[src_audio][powerof(x)].step) {
                        res &= ~x;
+                       continue;
+               }
 
                /* now check the opposite direction */
                if (!tr_matrix[powerof(x)][src_audio].step)
                        res &= ~x;
-
        }
 
        /* For a given source video format, traverse the list of
@@ -880,8 +881,10 @@ unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src
 
                /* if we don't have a translation path from the src
                   to this format, remove it from the result */
-               if (!tr_matrix[src_video][powerof(x)].step)
+               if (!tr_matrix[src_video][powerof(x)].step) {
                        res &= ~x;
+                       continue;
+               }
 
                /* now check the opposite direction */
                if (!tr_matrix[powerof(x)][src_video].step)