synclose.c

来自「linux环境下用纯c写的RTP协议的通用开发库」· C语言 代码 · 共 64 行

C
64
字号
/*------------------------------------------------------------------------- * 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 + =
减小字号Ctrl + -
显示快捷键?