Summary:ASTERISK-02933: [patch] adds shortcutting when selecting translation paths
Reporter:cmaj (cmaj)Labels:
Date Opened:2004-12-06 12:04:42.000-0600Date Closed:2008-01-15 15:15:48.000-0600
Versions:Frequency of
Environment:Attachments:( 0) channel_translation_shortcut.patch
Description:This removes a translator when it isn't necessary, ie. when requested to translate ULAW to ULAW.  Might as well shortcut and free the lock.  Patch is for both read and write, but only write was thoroughly tested.


Patch applies to latest 1-0 stable checkout, but should be applicable to current CVS as well.
Comments:By: Mark Spencer (markster) 2004-12-06 12:17:52.000-0600

Am I missing something?  If the formats are the same then the call to build path is essentially a noop since the while(source != dest) will immediately return, right?

By: cmaj (cmaj) 2004-12-06 13:35:47.000-0600

Yes, that would be a noop, but this patch will also skip the call to ast_translator_best_choice because there is no need to choose.

By: cmaj (cmaj) 2004-12-06 14:16:44.000-0600

Disclaimer is on file.

By: Mark Spencer (markster) 2004-12-06 16:55:52.000-0600

Unless you can show something to the contrary, I don't think this *particular* shortcut really saves enough CPU to merit the very straight forward flow of those two functions.  However I have added something in translate.c which should still help a little in performance without disrupting flow substantially.  Thanks for the pointer!

By: Russell Bryant (russell) 2004-12-06 18:20:17.000-0600

not in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:15:48.000-0600

Repository: asterisk
Revision: 4393

U   trunk/translate.c

r4393 | markster | 2008-01-15 15:15:48 -0600 (Tue, 15 Jan 2008) | 2 lines

Minor translation performance improvement (bug ASTERISK-2933, not that patch though)