Hi Arie, Just fixed this in SVN trunk, https://trac.pjsip.org/repos/ticket/1171. Thanks for the detail report. BR, nanang On Sat, Oct 23, 2010 at 9:03 PM, Arie Velthoen <arie_velthoen at hotmail.com> wrote: > Hi, > > I found that one cannot change one of a codec?s default dec_fmtp parameters > by simply doing: > ??? pj_str_t??????????? lv_codec; > ??? pjmedia_codec_param lv_codec_param; > ??? lv_codec = pj_str("some_codec"); > ??? pjsua_codec_get_param( &my_codec, &my_codec_param); > ??? modify lv_codec_param > ??? pjsua_codec_set_param( &my_codec, &my_codec_param); > > The first time pjsua_codec_set_param is called this is succesfull, but a > second time the? dec_fmtp are lost. > That is the number of dec_fmtp is still correct, but not the array contents. > This is so because pjmedia_codec_mgr_set_default_param, first releases the > memory pool of the codec_param, and then allocates new memory for the > codec_param, and using also fresh pool memory also for the dec_fmtp > parameters. > In the scheme above, the character-strings in the dec_fmtp parameters were > still located in the just freed memory. > A solution within pjmedia_codec_mgr_set_default_param is creating a new > pool, and doing the copy actions, before releasing the old pool. > > Also ?pjmedia_codec_mgr_set_default_param?? contains the same for-loop is > twice, twice copying the ?dec_fmtp? parameters. > One of these should be to copy the ?enc_fmtp? parameters I guess. > ??? for (i = 0; i < param->setting.dec_fmtp.cnt; ++i) { > ?pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].name, > ??? ¶m->setting.dec_fmtp.param[i].name); > ?pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].val, > ??? ¶m->setting.dec_fmtp.param[i].val); > ??? } > ??? for (i = 0; i < param->setting.dec_fmtp.cnt; ++i) { > ?pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].name, > ??? ¶m->setting.dec_fmtp.param[i].name); > ?pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].val, > ??? ¶m->setting.dec_fmtp.param[i].val); > > > Regards, > > Arie > > _______________________________________________ > 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 > >