⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synsynchronize.c

📁 linux环境下用纯c写的RTP协议的通用开发库
💻 C
字号:
/*------------------------------------------------------------------------- * synsycnhronize.c - synsynchronize *------------------------------------------------------------------------- */#include <syn.h>#include <util.h>#include <strings.h>#include <unistd.h>#include <math.h>#ifdef RTPLIB_SYNCHRONIZE/*----------------------------------------------------------------------- * synsynchronize - synchronize group of streams with the same cname * Note: Stream synchronization is not currently fully tested. *----------------------------------------------------------------------- */intsynsynchronize(struct synsession *pssn, char *cname){	struct session	*psn;	struct cnamelist	*pcnl;	int                   i, rv;	struct synsyncargs    ssa;  	psn = pssn->ssn_session;	if (pthread_mutex_lock(&psn->sn_cnamemutex) != 0)		return ERROR;	/*	 * Lookup the list of SSRCs that have the same canme.	 */	pcnl = (struct cnamelist *) htget(psn->sn_cnames, (unsigned int) cname);	if (pcnl == NULL) {		pthread_mutex_unlock(&psn->sn_cnamemutex);		return ERROR;	}	memset(&ssa, 0, sizeof(struct synsyncargs));	/*	 * Do a synchronization to all streams in this session.	 */	rv = synsyncto(pssn, pcnl, &ssa.sa_ntp, &ssa.sa_localtime);	strcpy(ssa.sa_cname, cname);	/*	 * Do a synchronization to streams in other sessions	 * that we know about.	 */	for (i = 0; i < SYN_FDCNT; i++)		if (pssn->ssn_syncfds[i] != 0)			write(pssn->ssn_syncfds[i], (char *) &ssa, sizeof(struct synsyncargs));	pthread_mutex_unlock(&psn->sn_cnamemutex);	return OK;}#endif /* RTPLIB_SYNCHRONIZE */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -