1,Linphone初始化工作;
入口:linphone_core_new(...) -->linphone_core_init(core,vtable,config_path, factory_config_path, userdata);
I,首先就是与oRTP(基于RFC3550的一个实现)协议栈相关的初始化操作:如:ortp_init();
在这个函数里面做的工作有:
[A]av_profile_init()即负载类型的初始化。rtp最大支持128种负载类型。这里有个概念:
RtpProfile:
* The RTP profile is a table RTP_PROFILE_MAX_PAYLOADS entries to make the matching
* between RTP payload type number and the PayloadType that defines the type of
* media.
[B]rtp全局统计信息初始化
typedef struct rtp_stats
{
uint64_t packet_sent;
uint64_t sent; /* bytes sent */
uint64_t recv; /* bytes of payload received and delivered in time to the application */
uint64_t hw_recv; /* bytes of payload received */
uint64_t packet_recv; /* number of packets received */
uint64_t outoftime; /* number of packets that were received too late */
uint64_t cum_packet_loss; /* cumulative number of packet lost */
uint64_t bad; /* packets that did not appear to be RTP */
uint64_t discarded; /* incoming packets discarded because the queue exceeds its max size */
uint64_t sent_rtcp_packets; /* sent RTCP packets counter (only packets that embed a report block are considered) */
} rtp_stats_t;
接下来是Linphone所用到的一些负载类型的初始话(assign),包括音频,视频的,与number相关的及无关的两类;
II, 其次是mediastream2的一些初始化。ms_init();
包括日志相关的设置,ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
ortp_set_log_handler(ms_android_log_handler);
Filter初始化/注册:
/* register builtin MSFilter's */
for (i=0;ms_filter_descs[i]!=NULL;i++){
ms_filter_register(ms_filter_descs[i]);
}
声卡初始化,
cm=ms_snd_card_manager_get();
for (i=0;ms_snd_card_descs[i]!=NULL;i++){
ms_snd_card_manager_register_desc(cm,ms_snd_card_descs[i]);
}
网络摄像头的初始化,
MSWebCamManager *wm;
wm=ms_web_cam_manager_get();
for (i=0;ms_web_cam_descs[i]!=NULL;i++){
ms_web_cam_manager_register_desc(wm,ms_web_cam_descs[i]);
}
绘制视频图像初始化(opengl):
libmsandroidopengldisplay_init();
还要初始化一个mediastream2的事件队列:ms_event_queue_new();
III,再次就是初始化一个很重要的结构体对象:
struct Sal{
SalCallbacks callbacks;
MSList *calls; /*MSList of SalOp */
MSList *registers;/*MSList of SalOp */
MSList *out_subscribes;/*MSList of SalOp */
MSList *in_subscribes;/*MSList of SalOp */
MSList *pending_auths;/*MSList of SalOp */
MSList *other_transactions; /*MSList of SalOp */
int running;
int session_expires;
int keepalive_period;
void *up;
bool_t one_matching_codec;
入口:linphone_core_new(...) -->linphone_core_init(core,vtable,config_path, factory_config_path, userdata);
I,首先就是与oRTP(基于RFC3550的一个实现)协议栈相关的初始化操作:如:ortp_init();
在这个函数里面做的工作有:
[A]av_profile_init()即负载类型的初始化。rtp最大支持128种负载类型。这里有个概念:
RtpProfile:
* The RTP profile is a table RTP_PROFILE_MAX_PAYLOADS entries to make the matching
* between RTP payload type number and the PayloadType that defines the type of
* media.
[B]rtp全局统计信息初始化
typedef struct rtp_stats
{
uint64_t packet_sent;
uint64_t sent; /* bytes sent */
uint64_t recv; /* bytes of payload received and delivered in time to the application */
uint64_t hw_recv; /* bytes of payload received */
uint64_t packet_recv; /* number of packets received */
uint64_t outoftime; /* number of packets that were received too late */
uint64_t cum_packet_loss; /* cumulative number of packet lost */
uint64_t bad; /* packets that did not appear to be RTP */
uint64_t discarded; /* incoming packets discarded because the queue exceeds its max size */
uint64_t sent_rtcp_packets; /* sent RTCP packets counter (only packets that embed a report block are considered) */
} rtp_stats_t;
接下来是Linphone所用到的一些负载类型的初始话(assign),包括音频,视频的,与number相关的及无关的两类;
II, 其次是mediastream2的一些初始化。ms_init();
包括日志相关的设置,ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
ortp_set_log_handler(ms_android_log_handler);
Filter初始化/注册:
/* register builtin MSFilter's */
for (i=0;ms_filter_descs[i]!=NULL;i++){
ms_filter_register(ms_filter_descs[i]);
}
声卡初始化,
cm=ms_snd_card_manager_get();
for (i=0;ms_snd_card_descs[i]!=NULL;i++){
ms_snd_card_manager_register_desc(cm,ms_snd_card_descs[i]);
}
网络摄像头的初始化,
MSWebCamManager *wm;
wm=ms_web_cam_manager_get();
for (i=0;ms_web_cam_descs[i]!=NULL;i++){
ms_web_cam_manager_register_desc(wm,ms_web_cam_descs[i]);
}
绘制视频图像初始化(opengl):
libmsandroidopengldisplay_init();
还要初始化一个mediastream2的事件队列:ms_event_queue_new();
III,再次就是初始化一个很重要的结构体对象:
struct Sal{
SalCallbacks callbacks;
MSList *calls; /*MSList of SalOp */
MSList *registers;/*MSList of SalOp */
MSList *out_subscribes;/*MSList of SalOp */
MSList *in_subscribes;/*MSList of SalOp */
MSList *pending_auths;/*MSList of SalOp */
MSList *other_transactions; /*MSList of SalOp */
int running;
int session_expires;
int keepalive_period;
void *up;
bool_t one_matching_codec;