oRTP分析

oRTP分析

接口ortp_scheduler_init对调度模块进行初始化

/**
 *  Initialize the oRTP scheduler. You only have to do that if you intend to use the
 *  scheduled mode of the #RtpSession in your application.
**/
void ortp_scheduler_init()
{
    static bool_t initialized=FALSE;
    if (initialized) return;
    initialized=TRUE;
#ifdef __hpux
    /* on hpux, we must block sigalrm on the main process, because signal delivery
    is ?random?, well, sometimes the SIGALRM goes to both the main thread and the
    scheduler thread */
    sigset_t set;
    sigemptyset(&set);
    sigaddset(&set,SIGALRM);
    sigprocmask(SIG_BLOCK,&set,NULL);
#endif /* __hpux */

    __ortp_scheduler=rtp_scheduler_new();
    rtp_scheduler_start(__ortp_scheduler);
}
struct _RtpScheduler {

    RtpSession *list;   /* list of scheduled sessions*/
    SessionSet  all_sessions;  /* mask of scheduled sessions */
    int     all_max;        /* the highest pos in the all mask */
    SessionSet  r_sessions;     /* mask of sessions that have a recv event */
    int     r_max;
    SessionSet  w_sessions;     /* mask of sessions that have a send event */
    int         w_max;
    SessionSet  e_sessions; /* mask of session that have error event */
    int     e_max;
    int max_sessions;       /* the number of position in the masks */
  /* GMutex  *unblock_select_mutex; */
    ortp_cond_t   unblock_select_cond;
    ortp_mutex_t    lock;
    ortp_thread_t thread;
    int thread_running;
    struct _RtpTimer *timer;
    uint32_t time_;       /*number of miliseconds elapsed since the start of the thread */
    uint32_t timer_inc; /* the timer increment in milisec */
};

typedef struct _RtpScheduler RtpScheduler;

在该接口中创建一个RtpScheduler类型的结构体__ortp_scheduler,并调用rtp_scheduler_init初始化它。

初始化完后调用rtp_scheduler_start启动调度任务

调度任务的执行体为rtp_scheduler_schedule,参数为调度结构体自身

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值