summaryrefslogtreecommitdiff
path: root/main/translate.c
AgeCommit message (Collapse)Author
2008-10-09(closes issue #13557)Steve Murphy
Reported by: nickpeirson Patches: pbx.c.patch uploaded by nickpeirson (license 579) replace_bzero+bcopy.patch uploaded by nickpeirson (license 579) Tested by: nickpeirson, murf 1. replaced all refs to bzero and bcopy to memset and memmove instead. 2. added a note to the CODING-GUIDELINES 3. add two macros to asterisk.h to prevent bzero, bcopy from creeping back into the source 4. removed bzero from configure, configure.ac, autoconfig.h.in git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@147807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-06Merged revisions 135915 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r135915 | tilghman | 2008-08-05 22:24:56 -0500 (Tue, 05 Aug 2008) | 4 lines Since powerof() can return an error condition, it's foolhardy not to detect and deal with that condition. (Related to issue #13240) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135938 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-26Convert casts to unions, to fix alignment issues on SolarisTilghman Lesher
(closes issue #12932) Reported by: snuffy Patches: bug_12932_20080627.diff uploaded by snuffy (license 35) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-22- revert change to ast_queue_hangup and create ast_queue_hangup_with_causeMichiel van Baak
- make data member of the ast_frame struct a named union instead of a void Recently the ast_queue_hangup function got a new parameter, the hangupcause Feedback came in that this is no good and that instead a new function should be created. This I did. The hangupcause was stored in the seqno member of the ast_frame struct. This is not very elegant, and since there's already a data member that one should be used. Problem is, this member was a void *. Now it's a named union so it can hold a pointer, an uint32 and there's a padding in case someone wants to store another type in there in the future. This commit is so massive, because all ast_frame.data uses have to be altered to ast_frame.data.data Thanks russellb and kpfleming for the feedback. (closes issue #12674) Reported by: mvanbaak git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-18Go through and fix a bunch of places where character strings were being ↵Terry Wilson
interpreted as format strings. Most of these changes are solely to make compiling with -Wsecurity and -Wformat=2 happy, and were not actual problems, per se. I also added format attributes to any printf wrapper functions I found that didn't have them. -Wsecurity and -Wmissing-format-attribute added to --enable-dev-mode. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-05Merged revisions 105932 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r105932 | russell | 2008-03-04 19:52:18 -0600 (Tue, 04 Mar 2008) | 5 lines Fix a bug that I just noticed in the RTP code. The calculation for setting the len field in an ast_frame of audio was wrong when G.722 is in use. The len field represents the number of ms of audio that the frame contains. It would have set the value to be twice what it should be. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04Whitespace changes onlyTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-11Just some minor coding style cleanup...Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103318 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-31Merged revisions 101601 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r101601 | russell | 2008-01-31 17:10:06 -0600 (Thu, 31 Jan 2008) | 12 lines Fix a couple of places where ast_frfree() was not called on a frame that came from a translator. This showed itself by g729 decoders not getting released. Since the flag inside the translator frame never got unset by freeing the frame to indicate it was no longer in use, the translators never got destroyed, and thus the g729 licenses were not released. (closes issue #11892) Reported by: xrg Patches: 11892.diff uploaded by russell (license 2) Tested by: xrg, russell ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@101611 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-15Clean up something I did for ABI compatability in 1.4Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-15Merged revisions 98943 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r98943 | russell | 2008-01-15 17:26:52 -0600 (Tue, 15 Jan 2008) | 25 lines Commit a fix for some memory access errors pointed out by the valgrind2.txt output on issue #11698. The issue here is that it is possible for an instance of a translator to get destroyed while the frame allocated as a part of the translator is still being processed. Specifically, this is possible anywhere between a call to ast_read() and ast_frame_free(), which is _a lot_ of places in the code. The reason this happens is that the channel might get masqueraded during this time. During a masquerade, existing translation paths get destroyed. So, this patch fixes the issue in an API and ABI compatible way. (This one is for you, paravoid!) It changes an int in ast_frame to be used as flag bits. The 1 bit is still used to indicate that the frame contains timing information. Also, a second flag has been added to indicate that the frame came from a translator. When a frame with this flag gets released and has this flag, a function is called in translate.c to let it know that this frame is doing being processed. At this point, the flag gets cleared. Also, if the translator was requested to be destroyed while its internal frame still had this flag set, its destruction has been deffered until it finds out that the frame is no longer being processed. Admittedly, this feels like a hack. But, it does fix the issue, and I was not able to think of a better solution ... ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98944 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-14Merged revisions 98774 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r98774 | russell | 2008-01-14 11:38:38 -0600 (Mon, 14 Jan 2008) | 3 lines Revert a change that introduces an unacceptable performance hit and is causing memory leaks ... (from rev 97973) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98775 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-11Fix "core show translation" to not output information for "unknown" codecs.Mark Michelson
This fix was made in favor of the proposed patch since it doesn't involve changing a core codec define. (closes issue #11722, reported and initially patched by caio1982, final patch by me) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98047 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-11Simplify this code with a suggestion from Luigi on the asterisk-dev list.Russell Bryant
Instead of using is16kHz(), implement a format_rate() function. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98024 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-10Merged revisions 97973 via svnmerge from Tilghman Lesher
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r97973 | tilghman | 2008-01-10 17:08:36 -0600 (Thu, 10 Jan 2008) | 6 lines 1) When we get a translated frame out, clone it, because if the translator pvt is freed before we use the frame, bad things happen. 2) Getting a failure from ast_sched_delete means that the schedule ID is currently running. Don't just ignore it. (Closes issue #11698) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-10Merged revisions 97976 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r97976 | russell | 2008-01-10 17:30:40 -0600 (Thu, 10 Jan 2008) | 3 lines Fix various timing calculations that made assumptions that the audio being processed was at a sample rate of 8 kHz. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-10spaces to tabsRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97769 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-02For some odd reason, the last set of libresample build changes from Kevin didRussell Bryant
not work for everyone, but it did for some. This set of changes makes trunk start again for those having problems. Instead of building libresample as a static library, it just links the object files in directly with the asterisk binary. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-02go back to including libresample in the main Asterisk binary, but this time ↵Kevin P. Fleming
including a small hack to ensure that it does get linked in (and also modify the strip_nonapi script to leave the resample_<foo> symbols alone) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95816 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-02Make the translation table show slin16Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@95735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-27Merged revisions 94828-94829 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r94828 | russell | 2007-12-27 08:33:21 -0600 (Thu, 27 Dec 2007) | 9 lines Change ast_translator_best_choice() to only pay attention to audio formats. This fixes a problem where Asterisk claims that a translation path can not be found for channels involving video. (closes issue #11638) Reported by: cwhuang Tested by: cwhuang Patch suggested by cwhuang, with some additional changes by me. ........ r94829 | russell | 2007-12-27 08:44:29 -0600 (Thu, 27 Dec 2007) | 2 lines Use the constant that I really meant to use here ... ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@94830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-17Merged revisions 93381 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r93381 | qwell | 2007-12-17 16:45:57 -0600 (Mon, 17 Dec 2007) | 4 lines What was I thinking when I wrote this masterpiece? -1 + 1 = 0.. who woulda thunk it?. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93390 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21remove a bunch of useless #include "options.h"Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-20Minor documentation tweak and if an incorrect parameter is given to core ↵Joshua Colp
show translation return the usage information. (closes issue #11316) Reported by: eliel Patches: translate.c.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19another bunch of include removals (errno.h and asterisk/logger.h)Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-17trim more redundant headersLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16Start untangling header inclusion in a way that does not affectLuigi Rizzo
build times - tested, there is no measureable difference before and after this commit. In this change: use asterisk/compat.h to include a small set of system headers: inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h, stdlib.h, alloca.h, stdio.h Where available, the inclusion is conditional on HAVE_FOO_H as determined by autoconf. Normally, source files should not include any of the above system headers, and instead use either "asterisk.h" or "asterisk/compat.h" which does it better. For the time being I have left alone second-level directories (main/db1-ast, etc.). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08improve linked-list macros in two ways:Kevin P. Fleming
- the *_CURRENT macros no longer need the list head pointer argument - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-06Commit some cleanups to the format type code.Tilghman Lesher
- Remove the AST_FORMAT_MAX_* types, as these are consuming 3 out of our available 32 bits. - Add a native slin16 type, so that 16kHz codecs can translate without losing resolution. (This doesn't affect anything immediately, until another codec has wb support.) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22Switch from AST_CLI (formerly NEW_CLI) to AST_CLI_DEFINE, since the former ↵Jason Parker
didn't make much sense git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19Convert NEW_CLI to AST_CLI.Jason Parker
Closes issue #11039, as suggested by seanbright. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-11Merge a ton of NEW_CLI conversions. Thanks to everyone that helped out! :)Russell Bryant
(closes issue #10724) Reported by: eliel Patches: chan_skinny.c.patch uploaded by eliel (license 64) chan_oss.c.patch uploaded by eliel (license 64) chan_mgcp.c.patch2 uploaded by eliel (license 64) pbx_config.c.patch uploaded by seanbright (license 71) iax2-provision.c.patch uploaded by eliel (license 64) chan_gtalk.c.patch uploaded by eliel (license 64) pbx_ael.c.patch uploaded by seanbright (license 71) file.c.patch uploaded by seanbright (license 71) image.c.patch uploaded by seanbright (license 71) cli.c.patch uploaded by moy (license 222) astobj2.c.patch uploaded by moy (license 222) asterisk.c.patch uploaded by moy (license 222) res_limit.c.patch uploaded by seanbright (license 71) res_convert.c.patch uploaded by seanbright (license 71) res_crypto.c.patch uploaded by seanbright (license 71) app_osplookup.c.patch uploaded by seanbright (license 71) app_rpt.c.patch uploaded by seanbright (license 71) app_mixmonitor.c.patch uploaded by seanbright (license 71) channel.c.patch uploaded by seanbright (license 71) translate.c.patch uploaded by seanbright (license 71) udptl.c.patch uploaded by seanbright (license 71) threadstorage.c.patch uploaded by seanbright (license 71) db.c.patch uploaded by seanbright (license 71) cdr.c.patch uploaded by moy (license 222) pbd_dundi.c.patch uploaded by moy (license 222) app_osplookup-rev83558.patch uploaded by moy (license 222) res_clioriginate.c.patch uploaded by moy (license 222) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@85460 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-29Let's use process time instead of wall clock time for show translationMatthew Fredrickson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@84115 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-20This change set fixes bug 8126 in trunk. It is implemented via compile time ↵Steve Murphy
options, activated via the menuselect stuff, which defaults to the old way. non-zero sample data added. Translate tables expressed in microseconds instead of milliseconds, with 5-digit data now instead of 3, giving 2 more digits of precision. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80113 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-26Do a massive conversion for using the ast_verb() macroRussell Bryant
(closes issue #10277, patches by mvanbaak) Basically, this changes ... if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3, "Something\n"); to ... ast_verb(3, "Something\n"); git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-25change the debug level to 3 for an exceedingly annoying messageLuigi Rizzo
(3-deep nested loop) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-24Conversions to ast_debug()Russell Bryant
(issue #9984, patches from eliel and dimas) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@71338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-06Issue 9869 - replace malloc and memset with ast_calloc, and other coding ↵Tilghman Lesher
guidelines changes git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-06Merged revisions 67631 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r67631 | file | 2007-06-06 09:18:39 -0400 (Wed, 06 Jun 2007) | 2 lines Fix plc_samples warning when registering a translator. (issue #9897 reported by xylome) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-24Merged revisions 65877 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r65877 | qwell | 2007-05-24 11:14:02 -0400 (Thu, 24 May 2007) | 4 lines Fix handling of zero-length frames when a codec is capable of native PLC. Issue 9183, patch by Mihai. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65903 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-16convert ast_build_str to ast_str_*Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48516 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-06Staticize one, and Constify a bunch of usage strings for CLI commands.Russell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-24This fix inspired by a patch supplied in bug 8189, which points out problems ↵Steve Murphy
with the PLC code git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-02Convert translation core linked list over to read/write based one, since it ↵Joshua Colp
spends most of it's time only reading. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46972 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-31Merged revisions 46714 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r46714 | kpfleming | 2006-10-31 15:47:48 -0600 (Tue, 31 Oct 2006) | 2 lines add an API so that translators can activate/deactivate themselves when needed ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-31Fix "core show translation" output. Issue #8243, patch by Damin.Jason Parker
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-31Merged revisions 46554 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r46554 | russell | 2006-10-31 00:55:07 -0500 (Tue, 31 Oct 2006) | 5 lines Add a small tweak to the code that checks to see whether destination formats 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/trunk@46556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-30Merged revisions 46526 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r46526 | kpfleming | 2006-10-30 16:19:55 -0600 (Mon, 30 Oct 2006) | 3 lines when unregistering a translator, don't rebuild the translation matrix unless needed when filtering formats out of an offer, ensure we check for translation ability in both directions ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-26Merged revisions 46329 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r46329 | russell | 2006-10-26 11:31:05 -0500 (Thu, 26 Oct 2006) | 11 lines - If the source has no audio or no video portion, do not call powerof() to get the format index. - Don't run through the audio and video loops if there is no audio or video portion of the source If 0 is passed to powerof, it will return -1. This value of -1 was then being used as an array index in these loops, which caused a crash on some systems. Other than this issue, this code works as we expected it to. If a format is not in the source, and we have to translation path to it, it is not offered in the list of acceptable destination formats. (fixes issue #8231) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-25Merged revisions 46082-46083,46152-46153 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r46082 | kpfleming | 2006-10-23 22:45:42 -0500 (Mon, 23 Oct 2006) | 2 lines add an API call to allow channel drivers to determine which media formats are compatible (passthrough or transcode) with the format an existing channel is already using ........ r46083 | kpfleming | 2006-10-23 22:53:32 -0500 (Mon, 23 Oct 2006) | 2 lines ensure that the translation matrix is properly lock-protected every place it is used ........ r46152 | kpfleming | 2006-10-24 18:45:19 -0500 (Tue, 24 Oct 2006) | 2 lines if multiple translators are registered for the same source/dest combination, ensure that the lowest-cost one is always inserted earlier in the list ........ r46153 | kpfleming | 2006-10-24 19:10:54 -0500 (Tue, 24 Oct 2006) | 2 lines code zone experiment: don't offer formats in the outbound INVITE that aren't either passthrough or translatable ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46203 65c4cc65-6c06-0410-ace0-fbb531ad65f3