📄 synclose.c
字号:
/*------------------------------------------------------------------------- * synclose.c - synclose *------------------------------------------------------------------------- */#include <syn.h>#include <stdlib.h>#include <util.h>/*------------------------------------------------------------------------ * synclose - close a synchronization layer session *------------------------------------------------------------------------ */#define SYNCLOSE_SOURCESBUFSZ 128intsynclose(struct synsession *pssn){ ssrc_t sources[SYNCLOSE_SOURCESBUFSZ]; int ssrccount, i; /* * Cleanly stop any threads run at this layer for * this synchronization session. */ stopthread(&pssn->ssn_eventthr, &pssn->ssn_eventthrmutex, &pssn->ssn_cond, &pssn->ssn_eventthrstat);#ifdef RTPLIB_SYNCHRONIZE stopthread(&pssn->ssn_recvthr, &pssn->ssn_recvthrmutex, &pssn->ssn_cond, &pssn->ssn_recvthrstat);#endif /* RTPLIB_SYNCHRONIZE */ /* * Turn off all streams. */ while (TRUE) { ssrccount = synsources(pssn, sources, SYNCLOSE_SOURCESBUFSZ); if (ssrccount > 0) for (i = 0; i < ssrccount; i++) synstreamoff(pssn, sources[i]); else break; } /* * Release all resources, including the RTP layer session. */ htdestroy(pssn->ssn_ssrcs); rtpctl(pssn->ssn_session, RTP_CTL_REMEVENTQUEUE, (void *) &pssn->ssn_events, 0, 0); eventqdestroy(&pssn->ssn_events); pthread_mutex_destroy(&pssn->ssn_getstreammutex); pthread_mutex_destroy(&pssn->ssn_mutex); pthread_mutex_destroy(&pssn->ssn_eventthrmutex); pthread_mutex_destroy(&pssn->ssn_recvthrmutex); rtpclose(pssn->ssn_session); free(pssn); return OK;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -