summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2011-05-27 07:28:28 +0000
committerBenny Prijono <bennylp@teluu.com>2011-05-27 07:28:28 +0000
commite8a508cfdf43638863daf0d18fea396224aca9ae (patch)
tree54cf445fd3f412d706ccebfdc350bf11cd08eb88 /pjmedia
parent6d9136ebc170264062f57ff5eb064e2e775be7b8 (diff)
Fixed #1301: Wrong alaw value is generated by the non-table version of pjmedia_linear2alaw() function for some specific PCM values (thanks K. Johnson for the fix)
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3575 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia/alaw_ulaw.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pjmedia/src/pjmedia/alaw_ulaw.c b/pjmedia/src/pjmedia/alaw_ulaw.c
index 7bb5c77f..0a14de87 100644
--- a/pjmedia/src/pjmedia/alaw_ulaw.c
+++ b/pjmedia/src/pjmedia/alaw_ulaw.c
@@ -128,6 +128,12 @@ PJ_DEF(pj_uint8_t) pjmedia_linear2alaw(
} else {
mask = 0x55; /* sign bit = 0 */
pcm_val = -pcm_val - 8;
+
+ /* https://trac.pjsip.org/repos/ticket/1301
+ * Thank you K Johnson - Zetron - 27 May 2011
+ */
+ if (pcm_val < 0)
+ pcm_val = 0;
}
/* Convert the scaled magnitude to segment number. */