[pjsip] L16 codec does not always initialize plc_enabled and vad_enabled
Nanang Izzuddin
nanang at pjsip.org
Fri Feb 13 10:39:27 EST 2009
Hi,
The L16 codec open() issue should be fixed by ticket #728
(http://trac.pjsip.org/repos/ticket/728).
About the G.711, I think we can't delete the #if, since
"g711_private.plc_enabled" may not be declared when PLC_DISABLED.
Thanks for the report!
Regards,
nanang
On Thu, Feb 12, 2009 at 10:00 PM, yyy public <yyypublic at googlemail.com> wrote:
> 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?
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
More information about the pjsip
mailing list