linphone源码分析----初始化部分

本文详细分析了linphone源码中的初始化过程,从linphone_core_new和linphone_core_init函数开始,包括ortp模块、编码器配置、网络配置、音频、视频等子模块的初始化,并探讨了负载类型分配的实现细节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这几天比较轻松,所以打算好好来看看linphone的代码,源码版本为3.5.2。从linphone初始化的过程开始,首先来看linphone_core_new函数。 
LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
						const char *config_path, const char *factory_config_path, void * userdata)
{
	LinphoneCore *core=ms_new(LinphoneCore,1);
	linphone_core_init(core,vtable,config_path, factory_config_path, userdata);
	return core;
}

主要工作基本上在函数linphone_core_init中实现
static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path,
    const char *factory_config_path, void * userdata)
{
	memset (lc, 0, sizeof (LinphoneCore));
	lc->data=userdata;
	lc->ringstream_autorelease=TRUE;


	memcpy(&lc->vtable,vtable,sizeof(LinphoneCoreVTable));  //保存了回调函数表


	linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");  //设置linphone内部状态
	ortp_init();  //ortp模块初始化
	lc->dyn_pt=96;  //负载类型从96开始都是动态负载类型
	linphone_core_assign_payload_type(lc,&payload_type_pcmu8000,0,NULL);
	linphone_core_assign_payload_type(lc,&payload_type_gsm,3,NULL);
	linphone_core_assign_payload_type(lc,&payload_type_pcma8000,8,NULL);
	linphone_core_assign_payload_type(lc,&payload_type_speex_nb,110,"vbr=on");
	linphone_core_assign_payload_type(lc,&payload_type_speex_wb,111,"vbr=on");
	linphone_core_assign_payload_type(lc,&payload_type_speex_uwb,112,"vbr=on");
	linphone_core_assign
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值