pjsua_codec_set_param looses dec_fmtp parameter

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

 



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, 
    &param->setting.dec_fmtp.param[i].name);
 pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].val, 
    &param->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, 
    &param->setting.dec_fmtp.param[i].name);
 pj_strdup(pool, &p->param->setting.dec_fmtp.param[i].val, 
    &param->setting.dec_fmtp.param[i].val);
 
 
Regards,
 
Arie 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101023/cdf1c52b/attachment.html>


[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