L16 codec does not always initialize plc_enabled and vad_enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

There seems to be a problem in the L16 codec because l16_open does not
copy all the codec settings to the codec internal data structure. I
believe the following change would bring l16 in line with gsm.c g722.c
and g711.c:

static pj_status_t l16_open(pjmedia_codec *codec,
   pjmedia_codec_param *attr )
{
   struct l16_data *l16_data = NULL;
   PJ_ASSERT_RETURN(codec && codec->codec_data && attr, PJ_EINVAL);

   l16_data = (struct l16_data*) codec->codec_data;
   l16_data->vad_enabled = (attr->setting.vad != 0);
   l16_data->plc_enabled = (attr->setting.plc != 0);

   return PJ_SUCCESS;
}

If attr->setting.vad is disabled in the l16 codec, the
attr->setting.vad and .plc are never flushed to l16_data.vad_enabled
and l16_data.plc_enabled. This has not been noticed before because in
stream.c pjmedia_stream_create() the call to
stream->codec->op->modify(stream->codec, &stream->codec_param);
copies the settings instead of l16_open and this is only called when
vad is enabled.

Later in l16_decode l16.c line 675 the uninitialized variable is
accessed: if (l16_data->plc_enabled)

One, other point is that g711.c should probably initialize plc_enabled
always, even if !PLC_DISABLED

static pj_status_t g711_open(pjmedia_codec *codec,
                 pjmedia_codec_param *attr )
{
    struct g711_private *priv = (struct g711_private*) codec->codec_data;
    priv->pt = attr->info.pt;
#if !PLC_DISABLED <<<<<<<<< DELETE THIS!
    priv->plc_enabled = (attr->setting.plc != 0);
#endif
    priv->vad_enabled = (attr->setting.vad != 0);
    return PJ_SUCCESS;
}


Cheers,
Yann
ps Who creates the bug tickets? Do I create one myself?



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux