summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-07-26 11:23:07 +0000
committerBenny Prijono <bennylp@teluu.com>2006-07-26 11:23:07 +0000
commitd80219f36636faa876c84b586e7b4b4815767be3 (patch)
tree56d336b8a7467902fd0fb7cdfebf4b98c81c81e4 /pjmedia
parentd07ab9c6afb0fd00a30d503bc87786e895359f9c (diff)
Fixed rather loud clicking/tick noise when call is established. This was caused by the PLC not properly cleared before it is reused for the next call
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@627 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia-codec/gsm.c10
-rw-r--r--pjmedia/src/pjmedia/g711.c13
2 files changed, 22 insertions, 1 deletions
diff --git a/pjmedia/src/pjmedia-codec/gsm.c b/pjmedia/src/pjmedia-codec/gsm.c
index 57eb1900..633ddc1b 100644
--- a/pjmedia/src/pjmedia-codec/gsm.c
+++ b/pjmedia/src/pjmedia-codec/gsm.c
@@ -343,6 +343,8 @@ static pj_status_t gsm_dealloc_codec( pjmedia_codec_factory *factory,
pjmedia_codec *codec )
{
struct gsm_data *gsm_data;
+ pj_int16_t frame[160];
+ int i;
PJ_ASSERT_RETURN(factory && codec, PJ_EINVAL);
PJ_ASSERT_RETURN(factory == &gsm_codec_factory.base, PJ_EINVAL);
@@ -352,6 +354,14 @@ static pj_status_t gsm_dealloc_codec( pjmedia_codec_factory *factory,
/* Close codec, if it's not closed. */
gsm_codec_close(codec);
+ /* Clear left samples in the PLC, since codec+plc will be reused
+ * next time.
+ */
+ for (i=0; i<2; ++i) {
+ pjmedia_zero_samples(frame, PJ_ARRAY_SIZE(frame));
+ pjmedia_plc_save(gsm_data->plc, frame);
+ }
+
/* Put in the free list. */
pj_mutex_lock(gsm_codec_factory.mutex);
pj_list_push_front(&gsm_codec_factory.codec_list, codec);
diff --git a/pjmedia/src/pjmedia/g711.c b/pjmedia/src/pjmedia/g711.c
index 96604a91..a28051a0 100644
--- a/pjmedia/src/pjmedia/g711.c
+++ b/pjmedia/src/pjmedia/g711.c
@@ -357,7 +357,10 @@ static pj_status_t g711_alloc_codec( pjmedia_codec_factory *factory,
static pj_status_t g711_dealloc_codec(pjmedia_codec_factory *factory,
pjmedia_codec *codec )
{
-
+ struct g711_private *priv = codec->codec_data;
+ pj_int16_t frame[SAMPLES_PER_FRAME];
+ int i;
+
PJ_ASSERT_RETURN(factory==&g711_factory.base, PJ_EINVAL);
/* Check that this node has not been deallocated before */
@@ -366,6 +369,14 @@ static pj_status_t g711_dealloc_codec(pjmedia_codec_factory *factory,
return PJ_EINVALIDOP;
}
+ /* Clear left samples in the PLC, since codec+plc will be reused
+ * next time.
+ */
+ for (i=0; i<2; ++i) {
+ pjmedia_zero_samples(frame, PJ_ARRAY_SIZE(frame));
+ pjmedia_plc_save(priv->plc, frame);
+ }
+
/* Lock mutex. */
pj_mutex_lock(g711_factory.mutex);