?? hust_rtcpcname.c
字號:
/*------------------------------------------------------------------------- * rtcpcname.c - rtcpcnameadd, rtcpcnamerem *------------------------------------------------------------------------- */#include <ipOS.h>#include <ipHAL.h>#include <ipStack.h>#include <ipEthernet.h>#include "hust_rtp.h"#include "hust_rtplibcommon.h"#include "hust_rtcp.h"#include "hust_event.h"#include "hust_hash.h"#include "hust_linux.h"///#include <rtp.h>///#include <rtcp.h>///#include <util.h>///#include <hash.h>///#include <string.h>///#include <stdlib.h>///#include <strings.h>/*------------------------------------------------------------------------ * rtcpnameadd - insert a stream * in a list of streams with same cname *------------------------------------------------------------------------ */intrtcpcnameadd(struct session *psn, struct stream *pstm){ struct stream *first; struct cnamelist *pcnl;/// if (pthread_mutex_lock(&psn->sn_cnamemutex) != 0)/// return ERROR; /* * Lookup the list for the cname pstm->stm_cname. */ pcnl = (struct cnamelist *) htget(psn->sn_cnames, (unsigned long int) pstm->stm_cname); if (pcnl != NULL) { /* * Insert pstm into the list of struct stream *'s * for cname pstm->stm_cname. */ first = pcnl->cn_stream; pstm->stm_cnamenext = first->stm_cnamenext; first->stm_cnamenext = pstm; pstm->stm_cnameprev = first; if (pstm->stm_cnamenext != NULL) pstm->stm_cnamenext->stm_cnameprev = pstm; } else { /* * If the list does not exist, create it. */ pcnl = heap_alloc(sizeof(struct cnamelist)); memset(pcnl, 0, sizeof(struct cnamelist)); pcnl->cn_stream = pstm; pstm->stm_cnamenext = NULL; pstm->stm_cnameprev = NULL; htadd(psn->sn_cnames, (unsigned long int) strdup(pstm->stm_cname), pcnl); }/// pthread_mutex_unlock(&psn->sn_cnamemutex); return OK;}/*------------------------------------------------------------------------ * rtcpnamerem - remove a stream * from a list of streams with same cname *------------------------------------------------------------------------ */intrtcpcnamerem(struct session *psn, struct stream *pstm){ /* * Adjust pointers in the next and previous * nodes in the threading. *//// if (pthread_mutex_lock(&psn->sn_cnamemutex) != 0)/// return ERROR; if (pstm->stm_cnamenext != NULL) pstm->stm_cnamenext->stm_cnameprev = pstm->stm_cnameprev; if (pstm->stm_cnameprev != NULL) pstm->stm_cnameprev->stm_cnamenext = pstm->stm_cnamenext; /* * Check if the last source in the list was removed. * If the list is empty, delete the cname from the * cname hashtable. */ if (pstm->stm_cnameprev == NULL && pstm->stm_cnamenext == NULL) htdel(psn->sn_cnames, (unsigned long int) pstm->stm_cname); /// pthread_mutex_unlock(&psn->sn_cnamemutex); return OK; }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -