aboutsummaryrefslogtreecommitdiffstats
path: root/main/translate.c
AgeCommit message (Collapse)AuthorFilesLines
2010-06-031.4 version of the dead PLC code fix.mmichelson1-40/+6
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@267539 f38db490-d61c-443f-a65b-d21fe96a405b
2009-10-21Revert 225169, as this doesn't account for the possibility of a list of frames.russell1-6/+2
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@225171 f38db490-d61c-443f-a65b-d21fe96a405b
2009-10-21Isolate the frame returned from ast_translate().russell1-2/+6
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@225169 f38db490-d61c-443f-a65b-d21fe96a405b
2009-10-21Isolate frames returned from a DSP instance or codec translator.russell1-29/+1
The reasoning for these changes are the same as what I wrote in the commit message for rev 222878. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@224931 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-27Fix logic errors from 208746jpeeler1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@208923 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-25Fix compiling under dev-mode with gcc 4.4.0.jpeeler1-2/+2
Mostly trivial changes, but I did not know of any other way to fix the "dereferencing type-punned pointer will break strict-aliasing rules" error without creating a tmp variable in chan_skinny. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@208746 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-01fix a bunch of potential problems found by gcc 4.3.x, primarily bare strings ↵kpfleming1-2/+2
being passed to printf()-like functions and ignored results from read()/write() and friends git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@153337 f38db490-d61c-443f-a65b-d21fe96a405b
2008-10-14it would be nice if this message printing code had actually been tested ↵kpfleming1-1/+2
before it was committed... git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@148611 f38db490-d61c-443f-a65b-d21fe96a405b
2008-08-06Since powerof() can return an error condition, it's foolhardy not to detect andtilghman1-1/+14
deal with that condition. (Related to issue #13240) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@135915 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-05Fix a bug that I just noticed in the RTP code. The calculation for setting therussell1-11/+3
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: http://svn.digium.com/svn/asterisk/branches/1.4@105932 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-31Fix a couple of places where ast_frfree() was not called on a frame that camerussell1-0/+2
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: http://svn.digium.com/svn/asterisk/branches/1.4@101601 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-15Commit a fix for some memory access errors pointed out by the valgrind2.txtrussell1-3/+31
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: http://svn.digium.com/svn/asterisk/branches/1.4@98943 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-14Revert a change that introduces an unacceptable performance hit and is causingrussell1-4/+2
memory leaks ... (from rev 97973) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@98774 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-11Simplify this code with a suggestion from Luigi on the asterisk-dev list.russell1-19/+6
Instead of using is16kHz(), implement a format_rate() function. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@98025 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-10Fix various timing calculations that made assumptions that the audio beingrussell1-5/+34
processed was at a sample rate of 8 kHz. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@97976 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-101) When we get a translated frame out, clone it, because if thetilghman1-1/+4
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: http://svn.digium.com/svn/asterisk/branches/1.4@97973 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-27Use the constant that I really meant to use here ...russell1-3/+3
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@94829 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-27Change ast_translator_best_choice() to only pay attention to audio formats.russell1-4/+4
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. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@94828 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-17Missed a spot..qwell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@93420 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-17What was I thinking when I wrote this masterpiece?qwell1-7/+9
-1 + 1 = 0.. who woulda thunk it?. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@93381 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-06Fix plc_samples warning when registering a translator. (issue #9897 reported ↵file1-1/+1
by xylome) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@67631 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-24Fix handling of zero-length frames when a codec is capable of native PLC.qwell1-1/+3
Issue 9183, patch by Mihai. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@65877 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-24bug 8189 posted this fix for main/translate.c for PLCmurf1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@47992 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31Fix "core show translation" output. Issue #8243, patch by Damin.qwell1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46716 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31add an API so that translators can activate/deactivate themselves when neededkpfleming1-6/+37
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46714 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31revert changes that were the wrong way to address this... proper fix comingkpfleming1-48/+39
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46713 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31let's set the seen flag early enough to actually make a difference...kpfleming1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46712 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31don't re-do setup operations for translators that can dynamically register ↵kpfleming1-39/+48
themselves git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46711 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31Add a small tweak to the code that checks to see whether destination formatsrussell1-3/+6
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: http://svn.digium.com/svn/asterisk/branches/1.4@46554 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-30when unregistering a translator, don't rebuild the translation matrix unless ↵kpfleming1-1/+17
needed when filtering formats out of an offer, ensure we check for translation ability in both directions git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46526 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-26- If the source has no audio or no video portion, do not call powerof() torussell1-5/+20
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: http://svn.digium.com/svn/asterisk/branches/1.4@46329 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-25add passthrough and file format support for G.722 16KHz audio (issue #5084, ↵kpfleming1-2/+1
original patch by andrew, updated by mithraen) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46154 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-25code zone experiment: don't offer formats in the outbound INVITE that aren't ↵kpfleming1-0/+5
either passthrough or translatable git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46153 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-24if multiple translators are registered for the same source/dest combination, ↵kpfleming1-2/+20
ensure that the lowest-cost one is always inserted earlier in the list git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46152 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-24ensure that the translation matrix is properly lock-protected every place it ↵kpfleming1-4/+24
is used git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46083 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-24add an API call to allow channel drivers to determine which media formats ↵kpfleming1-0/+42
are compatible (passthrough or transcode) with the format an existing channel is already using git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@46082 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-18merge qwell's CLI verbification workkpfleming1-5/+81
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-30Clarify what show translations is displaying a bit more (issue #7772 ↵file1-1/+1
reported by Mithraen) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41373 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21merge new_loader_completion branch, including (at least):kpfleming1-0/+703
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b