(环境ubuntu1864bits)
安装下列包:
1 sudo apt-get install yasm
2 sudo apt-get installnasm
3 sudo apt-get installcurl [i]
4 sudo apt-get installant
5 sudo apt-get installautoconf
6 sudo apt-get installautomake
7 sudo apt-get installaclocal
8 sudo apt-get installlibtoolize
9 sudo apt-get installpkgconfig
10 sudo apt-get install ia32-libs
11 sudo apt-get install cmake
安装 readme里面安装相关sdk
执行prepare.yp生成 Makefile
执行 make
Linphone官方地址:http://www.linphone.org/technical-corner/linphone/downloads
LinphoneCore 这个是全局结构体,存储一些全局数据结构
LinphoneCall 主要会话相关的
LinphoneCoreVTable 提供linphone回调接口
LinphoneCallParams 一个呼叫所需的参数
linphone_sal_callbacks 所有sip会话的回调函数,调用MediaStream相关功能。
MSFilterDesc filter函数指针
MSFilter filter定义
MSTicker 媒体处理调度
MSFactory filter工厂,管理所有的filter
MSSndCardDesc 声卡设备的方法集合
MSWebCamManager 网络摄像头方法集合
RingStream 铃声全局结构体
AudioStream 音频流的全局结构体
VideoStream 视频流的全局结构体
TextStream 字幕流的全局结构体
MediaStream 所有流都需要的基础数据
MSMediaStreamIO 媒体流输入输出信息,根据这个信息创建所需要的filter
ms_base_filter_descs 基础的几个filter
ms_voip_filter_descs voip要用的filter
ms_snd_card_descs 定义所有声卡驱动
RtpSession rtp库总结构体,定义了rtp会话的主要数据结构
linphone_core_new 创建linphone结构体,有多种重载方法
linphone_core_init 初始化linphone结构体,初始化RTP模块 ortp_init,初始化 SIP sal_init
linphone_core_iterate 重复循环任务
call_ringing 铃声
linphone_call_update_streams{ 这个函数在呼叫成功或者接受呼叫的时候被调用
linphone_call_init_media_streams初始化媒体流 调用mediastream2层代码
linphone_call_start_media_streams{启动媒体播放
linphone_call_start_video_stream 启动视频播放流
linphone_call_start_audio_stream 启动视频播放流
}
}
sal_media_description_find_best_stream 找到最优的filter
sal_address_ref 创建了SalAddress
belle_sip_stack_create_listening_point 根据地址和端口和传输类型(udp/tcp/tls)创建本地socket监听
belle_sip_main_loop_iterate sip 主循环
belle_sip_dialog 启动一个sip会话事务。
belle_sip_main_loop_run sip会话循环线程,主要接受和发送sip消息
audio_stream_start_from_io 根据MSMediaStreamIO信息创建filter
media_stream_start_ticker 创建ticker 启动线程的地方
ms_create_duplex_rtp_session 创建rtpsession
ms_ticker_new_with_params 会创建ticker 并且创建执行线程
ms_ticker_init 线程初始化
ms_ticker_run 工作线程。
ms_thread_create ->ortp_thread_create,创建线程函数
ms_ulaw_dec_desc g711解码filter
ms_factory_new 创建一个filter的工厂
ms_factory_init 初始化工厂把基础filter挂接到factory上
ms_factory_init_voip 把voip要用的filter挂接到factory上
ms_factory_create_filter_from_desc 根据filter描述创建filter
ms_factory_create_encoder 创建编码filter
ms_factory_create_filter 根据filter id创建filter
ms_filter_new 根据id直接创建filter,自动找filter工厂
ms_filter_call_method 调用filter的方法设置filter
ms_filter_link 链接filter
ms_ticker_attach 开始调度filter
ms_ticker_destroy 停止filter
__ms_get_default_prio 获取缺省的线程优先级
ortp_init 初始化ortp库
ortp_exit 销毁ortp库
rtp_session_recvm_with_ts 从端口接收rtp数据
rtp_session_process_incoming 根据收到的包进行分类处理,分别加入到不同的队列
关键函数
linphone_core_new
linphone_core_new_with_config
_linphone_core_new_with_config
linphone_core_init
linphone_configuring_terminated
linphone_core_start
sip_config_read
linphone_core_set_sip_transports
_linphone_core_apply_transports
sal_listen_port
sal_add_listen_port
belle_sip_stack_create_listening_point
belle_sip_udp_listening_point_new
belle_sip_udp_listening_point_init
belle_sip_udp_listening_point_init_socket(这里设置接收udp数据的回调函数指针)
create_udp_socket
地址:
函数调用关系图:
关键函数
linphone_core_iterate
sal_iterate
belle_sip_stack_sleep
belle_sip_main_loop_sleep
belle_sip_main_loop_run
belle_sip_main_loop_iterate
belle_sip_poll (这个地方调用poll获取socket事件,后面的s->notify会调用接收udp数据的回调函数指针)
地址:
函数调用关系
关键函数
linphone_core_init
sal_set_callbacks 通过设置回调把MediaStream和belle-sip模块联系起来,sip模块收到sip消息后会自动回调MediaStream模块里面的创建流过程,并创建相应线程。
linphone_core_notify_incoming_call
linphone_call_accept
linphone_call_accept_with_params 被叫会依次调用以上函数
linphone_call_update_streams 其他回调调用这个函数更新媒体流
linphone_call_start_media_streams
linphone_call_start_audio_stream &&linphone_call_start_video_stream
audio_stream_start_from_io 创建filter并且把filter链接起来,创建调度线程开始处理媒体流。
media_stream_start_ticker 创建媒体处理线程。
地址:
函数调用关系
关键函数
linphone_core_new
linphone_core_iterate 循环检测sip事件
audio_stream_start_from_io
media_stream_start_ticker 创建媒体处理线程
地址:
一次呼叫的流程图(图片可以放大)
2018/6