From ef7bbab6bcc4cef87bfa733964113262cc53b545 Mon Sep 17 00:00:00 2001 From: sruffell Date: Thu, 4 Dec 2008 23:01:48 +0000 Subject: - Ensure that the sample size is set correctly when decoding G723 packets. - Do not use an already built channel if the source and destination formats do not match the formats we want. This fixes a regression introduced by the new transcoder interface where a translation path from one complex codec to another can result in garbled audio. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4592 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- kernel/wctc4xxp/base.c | 2 ++ kernel/zttranscode.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/kernel/wctc4xxp/base.c b/kernel/wctc4xxp/base.c index 930dbd3..4b22299 100644 --- a/kernel/wctc4xxp/base.c +++ b/kernel/wctc4xxp/base.c @@ -1756,6 +1756,8 @@ wctc4xxp_write(struct file *file, const char __user *frame, size_t count, loff_t return -EINVAL; } cpvt->timestamp += G723_SAMPLES; + } else if (ZT_FORMAT_G723_1 == dtc->dstfmt) { + cpvt->timestamp += G723_SAMPLES; } else { /* Same for ulaw and alaw */ cpvt->timestamp += G729_SAMPLES; diff --git a/kernel/zttranscode.c b/kernel/zttranscode.c index 239189d..5462da8 100644 --- a/kernel/zttranscode.c +++ b/kernel/zttranscode.c @@ -190,8 +190,17 @@ get_free_channel(struct zt_transcoder *tc) for (i = 0; i < tc->numchannels; i++) { chan = &tc->channels[i]; if (!zt_tc_is_busy(chan)) { - zt_tc_set_busy(chan); - return chan; + if (!zt_tc_is_built(chan)) { + zt_tc_set_busy(chan); + return chan; + } else { + /* If the channel is already built, we must + * make sure that it can support the formats + * that we're interested in. */ + if ((fmts->srcfmt|fmts->dstfmt) == + chan->built_fmts) + return chan; + } } } return NULL; -- cgit v1.2.3