summaryrefslogtreecommitdiff
path: root/main/jitterbuf.c
AgeCommit message (Collapse)Author
2017-12-20Fix Common Typo's.Corey Farrell
Fix instances of: * Retreive * Recieve * other then * different then * Repeated words ("the the", "an an", "and and", etc). * othterwise, teh ASTERISK-24198 #close Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31
2017-01-17abstract/fixed/adpative jitter buffer: disallow frame re-insertsKevin Harwell
It was possible for a frame to be re-inserted into a jitter buffer after it had been removed from it. A case when this happened was if a frame was read out of the jitterbuffer, passed to the translation core, and then multiple frames were returned from said translation core. Upon multiple frames being returned the first is passed on, but sebsequently "chained" frames are put back into the read queue. Thus it was possible for a frame to go back into the jitter buffer where this would cause problems. This patch adds a flag to frames that are inserted into the channel's read queue after translation. The abstract jitter buffer code then checks for this flag and ignores any frames marked as such. Change-Id: I276c44edc9dcff61e606242f71274265c7779587
2015-03-30clang compiler warnings: Fix -Wabsolute-value warningsMatthew Jordan
This patch fixes several warnings caught by clang - in this case, usage of the abs function on non-integer values. This patch uses labs and fabs, as appropriate, in the various affected files. Review: https://reviewboard.asterisk.org/r/4525 ASTERISK-24917 Reported by: dkdegroot patches: rb4525.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433749 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-24jitterbuf: Fix memory leak on jitter buffer resetJonathan Rose
(issue ASTERISK-22467) Reported by: Corey Farrell Patches: jitterbuf-jb_reset-leak-1.8.patch jitterbuf-jb_reset-leak-11up.patch ........ Merged revisions 401786 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401787 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401788 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15Multiple revisions 369001-369002Kevin P. Fleming
........ r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines Add support-level indications to many more source files. Since we now have tools that scan through the source tree looking for files with specific support levels, we need to ensure that every file that is a component of a 'core' or 'extended' module (or the main Asterisk binary) is explicitly marked with its support level. This patch adds support-level indications to many more source files in tree, but avoids adding them to third-party libraries that are included in the tree and to source files that don't end up involved in Asterisk itself. ........ r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines Add a script to enable finding source files without support-levels defined. ........ Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-19Fix a variety of potential buffer overflowsMatthew Jordan
* chan_mobile: Fixed an overrun where the cind_state buffer (an integer array of size 16) would be overrun due to improper bounds checking. At worst, the buffer can be overrun by a total of 48 bytes (assuming 4-byte integers), which would still leave it within the allocated memory of struct hfp. This would corrupt other elements in that struct but not necessarily cause any further issues. * app_sms: The array imsg is of size 250, while the array (ud) that the data is copied into is of size 160. If the size of the inbound message is greater then 160, up to 90 bytes could be overrun in ud. This would corrupt the user data header (array udh) adjacent to ud. * chan_unistim: A number of invalid memmoves are corrected. These would move data (which may or may not be valid) into the ends of these buffers. * asterisk: ast_console_toggle_loglevel does not check that the console log level being set is less then or equal to the allowed log levels of 32. * format_pref: In ast_codec_pref_prepend, if any occurrence of the specified codec is not found, the value used to index into the array pref->order would be one greater then the maximum size of the array. * jitterbuf: If the element being placed into the jitter buffer lands in the last available slot in the jitter history buffer, the insertion sort attempts to move the last entry in the buffer into one slot past the maximum length of the buffer. Note that this occurred for both the min and max jitter history buffers. * tdd: If a read from fsk_serial returns a character that is greater then 32, an attempt to read past one of the statically defined arrays containing the values that character maps to would occur. * localtime: struct ast_time and tm are not the same size - ast_time is larger, although it contains the elements of tm within it in the same layout. Hence, when using memcpy to copy the contents of tm into ast_time, the size of tm should be used, as opposed to the size of ast_time. * extconf: this treats ast_timing's minmask array as if it had a length of 48, when it has defined the size of the array as 24. pbx.h defines minmask as having a size of 48. (issue ASTERISK-19668) Reported by: Matt Jordan ........ Merged revisions 362485 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 362496 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22Kill off red blobs in most of main/*Kinsey Moore
Everything still compiled after making these changes, so I assume these whitespace-only changes didn't break anything (and shouldn't have). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14Fix incorrect jitter buffer overflow due to missed resynchronizationsMatthew Jordan
When a change in time occurs, such that the timestamps associated with frames being placed into an adaptive jitter buffer (implemented in jitterbuf.c) are significantly different then the previously inserted frames, the jitter buffer checks to see if it needs to be resynched to the new time frame. If three consecutive packets break the threshold, the jitter buffer resynchs itself to the new timestamps. This currently only occurs when history is calculated, and hence only on JB_TYPE_VOICE frames. JB_TYPE_CONTROL frames, on the other hand, are never passed to the history calculations. Because of this, if the jump in time is greater then the maximum allowed length of the jitter buffer, the JB_TYPE_CONTROL frames are dropped and no resynchronization occurs. Alterntively, if the overfill logic is not triggered, the JB_TYPE_CONTROL frame will be placed into the buffer, but with a time reference that is not applicable. Subsequent JB_TYPE_VOICE frames will quickly trigger the overflow logic until reads from the jitter buffer reach the errant JB_TYPE_CONTROL frame. This patch allows JB_TYPE_CONTROL frames to resynch the jitter buffer. As JB_TYPE_CONTROL frames are unlikely to occur in multiples, it perform the resynchronization on any JB_TYPE_CONTROL frame that breaks the resynch threshold. Note that this only impacts chan_iax2, as other consumers of the adaptive jitter buffer use the abstract jitter buffer API, which does not use JB_TYPE_CONTROL frames. Review: https://reviewboard.asterisk.org/r/1814/ (closes issue ASTERISK-18964) Reported by: Kris Shaw Tested by: Kris Shaw, Matt Jordan Patches: jitterbuffer-2012-2-26.diff uploaded by Kris Shaw (license 5722) ........ Merged revisions 359356 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 359358 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359359 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-10Merged revisions 174583 via svnmerge from Matthew Nicholson
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r174583 | mnicholson | 2009-02-10 11:52:42 -0600 (Tue, 10 Feb 2009) | 18 lines Improve behavior of jitterbuffer when maxjitterbuffer is set. This change improves the way the jitterbuffer handles maxjitterbuffer and dramatically reduces the number of frames dropped when maxjitterbuffer is exceeded. In the previous jitterbuffer, when maxjitterbuffer was exceeded, all new frames were dropped until the jitterbuffer is empty. This change modifies the code to only drop frames until maxjitterbuffer is no longer exceeded. Also, previously when maxjitterbuffer was exceeded, dropped frames were not tracked causing stats for dropped frames to be incorrect, this change also addresses that problem. (closes issue #14044) Patches: bug14044-1.diff uploaded by mnicholson (license 96) Tested by: mnicholson Review: http://reviewboard.digium.com/r/144/ ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@174584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10Another big chunk of changes from the RSW branch. Bunch of stuff from main/Sean Bright
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137082 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-04Whitespace changes onlyTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105840 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-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-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-01-29Merged revisions 52494,52506 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r52494 | jdixon | 2007-01-28 22:18:36 -0600 (Sun, 28 Jan 2007) | 4 lines Fixed problem with jitterbuf, whereas it would not complain about, and would allow itself to be overfilled (per the max_jitterbuf parameter). Now it rejects any data over and above that size, and complains about it. ........ r52506 | russell | 2007-01-29 10:54:27 -0600 (Mon, 29 Jan 2007) | 5 lines Clean up a few things in the last commit to the adaptive jitterbuffer code. - Specifically indicate to the compiler that the "dropem" variable only needs one but. - Change formatting to conform to coding guidelines. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@52522 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-25Merged revisions 52265 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r52265 | file | 2007-01-25 14:18:33 -0500 (Thu, 25 Jan 2007) | 10 lines Merged revisions 52264 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r52264 | file | 2007-01-25 14:15:29 -0500 (Thu, 25 Jan 2007) | 2 lines Allow dequeueing of frames with negative timestamp by moving jitterbuffer frames check to jb_next. (issue #8546 reported by harmen) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@52266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-23Cosmetic changes. Make main source files better conform to coding guidelines ↵Joshua Colp
and standards. (issue #8679 reported by johann8384) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-21As per bug 7978, this version introduces the jittertargetextra option in ↵Steve Murphy
config files git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21merge new_loader_completion branch, including (at least):Kevin P. Fleming
- 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: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3