一 头文件分析
从例子源码rtpsend.c看,主要的初始话步骤是:
ortp_init();
ortp_scheduler_init();
session=rtp_session_new(RTP_SESSION_SENDONLY);
这三步中涉及到了主要的结构体,具体如下:
1.1 ortp_init()涉及_RtpProfile和rtp_stats
void ortp_init()
{
static bool_t initialized=FALSE;
if (initialized) return;
initialized=TRUE;
#ifdef WIN32
win32_init_sockets();
#endif
av_profile_init(&av_profile);
ortp_global_stats_reset();//重置rtp_stats结构
init_random_number_generator();
ortp_message("oRTP-" ORTP_VERSION " initialized.");
}
主要涉及结构体:RtpProfile av_profile; RtpProfile在payloadtype.h中
/**
* 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.
**/
/*这个结构是用于将RTP负载类型数字与具体的负载类型定义关联
例如,
rtp_profile_set_payload(&av_profile, 96, &payload_type_h264);
rtp_session_set_payload_type(session, 96);
就是将96与h264关联起来
*/
struct _RtpProfile
{
char *name;
PayloadType *payload[RTP_PROFILE_MAX_PAYLOADS];