?? hust_rtcpsr.c
字號:
/*------------------------------------------------------------------------- * rtcpsr.c - rtcpsr *------------------------------------------------------------------------- */#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 <hash.h>///#include <rtcp.h>///#include <rtp.h>/*------------------------------------------------------------------------ * rtcpsr - process an incoming RTCP sender report *------------------------------------------------------------------------ */intrtcpsr(struct session *psn, struct rtcp *prtcp, struct netbuf *udpnb){ /// struct sr *psr; ssrc_t ssrc; struct stream *pstm;/// addr_t srdatalen; if (prtcp->rtcp_type != RTCP_SR) return ERROR; /* psr = (struct sr *) heap_alloc(sizeof(struct sr)); prtcp->rtcp_data = psr; memset(psr, 0, sizeof(struct sr)); psr->sr_ssrc = netbuf_fwd_read_u32(udpnb); psr->sr_intts = netbuf_fwd_read_u32(udpnb); psr->sr_fracts = netbuf_fwd_read_u32(udpnb); psr->sr_rtpts = netbuf_fwd_read_u32(udpnb); psr->sr_packets = netbuf_fwd_read_u32(udpnb); psr->sr_octets = netbuf_fwd_read_u32(udpnb);*/ ssrc = netbuf_fwd_read_u32(udpnb);/* srdatalen = RTCP_LENGTH_BYTE(prtcp)-RTCP_HEADERSZ-RTCP_SRSZ; if(srdatalen) { psr->sr_rblock = heap_alloc(srdatalen); netbuf_fwd_read_mem(udpnb,psr->sr_rblock,srdatalen); } else psr->srblock = NULL;*/ pstm = rtpgetstream(psn, ssrc); if (pstm == NULL) if ((pstm = rtpnewstream(psn, ssrc)) == NULL) return ERROR; if (!RTP_INACTIVE(pstm->stm_inactive)) pstm->stm_inactive = 0; else { rtpreleasestream(psn, pstm); return OK; } /* * Record data needed to generate receiver report. *//*/// pthread_mutex_lock(&pstm->stm_mutex); pstm->stm_lastsr=timer_get_ticks(); ///pstm->stm_lastsrts = ntohl(psr->sr_rtpts); pstm->stm_lastsrts=psr->sr_rtpts; ///pstm->stm_lastntp[RTP_NTPFRAC] = ntohl(psr->sr_fracts); pstm->stm_lastntp[RTP_NTPFRAC] = psr->sr_fracts; ///pstm->stm_lastntp[RTP_NTPINT] = ntohl(psr->sr_intts); pstm->stm_lastntp[RTP_NTPINT]= psr->sr_intts;/// pthread_mutex_unlock(&pstm->stm_mutex);*/ pstm->stm_lastntp[RTP_NTPINT]= netbuf_fwd_read_u32(udpnb); pstm->stm_lastntp[RTP_NTPFRAC] = netbuf_fwd_read_u32(udpnb); pstm->stm_lastsrts = netbuf_fwd_read_u32(udpnb); pstm->stm_sdpackets = netbuf_fwd_read_u32(udpnb); pstm->stm_sdoctets = netbuf_fwd_read_u32(udpnb); /* * Post an event with the sender hreport as data. *//* rtppostevent(psn, EVENT_RTCP_SR, pstm->stm_ssrc, (char *) prtcp, RTCP_LENGTH_BYTE(prtcp));*/ rtpreleasestream(psn, pstm);/// heap_free(psr->sr_rblock);/// heap_free(psr); return OK;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -