📄 hust_rtpnewstream.c
字号:
/*------------------------------------------------------------------------- * rtpnewstream.c - rtpnrestream *------------------------------------------------------------------------- */#include <ipOS.h>#include <ipHAL.h>///#include <limits.h>#include "hust_rtp.h"///#include <pthread.h>///#include <stdlib.h>///#include <strings.h>#include "hust_hash.h"#include "hust_event.h"/*------------------------------------------------------------------------ * rtpnewstream - create state for newly detected stream * The refcount is initialized to 1. Thus the caller must release the * stream when finished with it. *------------------------------------------------------------------------ *//*struct stream *rtpnewstream(struct session *psn, u32_t ssrc )*/struct stream *rtpnewstream(){ struct stream *pstm; pstm = (struct stream *) heap_alloc(sizeof(struct stream)); ///为stream结构分配内存空间 if (pstm == NULL) return NULL; memset(pstm, 0, sizeof(struct stream)); //按照struct stream的格式设置内存 rtpqinit(&pstm->stm_queue); ///初始化stream中的queue ///pthread_mutex_init(&pstm->stm_mutex, NULL);/// pstm->stm_ssrc = ssrc; pstm->stm_ssrc = 0; pstm->stm_ip = INADDR_ANY; /////表示可以和任何主机通信 pstm->stm_enqueue=TRUE; pstm->stm_payload = MPEG2TYPE; pstm->stm_inactthresh = RTP_DEFAULT_INACTIVETHRESH; pstm->stm_probation = RTP_MINSEQUENTIAL; pstm->stm_refcnt = 1; ///pstm->stm_hiseq=hiseq-1; pstm->stm_cname=NULL; pstm->stm_name=NULL; pstm->stm_email=NULL; pstm->stm_phone=NULL; pstm->stm_loc=NULL; pstm->stm_tool=NULL; pstm->stm_note=NULL; pstm->stm_priv=NULL; /// htadd(psn->sn_ssrcs, ssrc, pstm); ///把队列加入到哈希表中/// rtpcheckcollision(psn, ssrc); ///判断接收到的stream的同步源标识符 ///是否和自己的冲突// rtppostevent(psn, EVENT_PARTICIPANT_NEW, ssrc, NULL, 0); ///发出事件,告知有新成员加入 return pstm;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -