rtpclose.c

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

C
61
字号
/*------------------------------------------------------------------------- * rtpclose.c - rtpclose *------------------------------------------------------------------------- */#include <rtp.h>#include <rtcp.h>#include <unistd.h>#include <stdlib.h>#include <hash.h>#include <stdio.h>#include <arpa/inet.h>/*------------------------------------------------------------------------ * rtpclose - close the rtp session pointed to by psn *------------------------------------------------------------------------ */intrtpclose(struct session *psn){	bool false = FALSE;	/* 	 * Stop threads cleanly.	 */	rtpctl(psn, RTP_CTL_RTCPRECVTHREAD, (char *) &false, 0, 0);	rtpctl(psn, RTP_CTL_RTPRECVTHREAD, (char *) &false, 0, 0);	rtpctl(psn, RTP_CTL_RTCPCYCLETHREAD, (char *) &false, 0, 0);	/*	 * Send RTCP bye message to group.	 */	rtcpsendbye(psn, "Leaving");	/*	 * Release all resources.	 */	close(psn->sn_rtpfd);	close(psn->sn_rtcpfd);	htdestroy(psn->sn_cnames);	htdestroy(psn->sn_ssrcs);  	bufpooldestroy(&psn->sn_bpool);	free(psn->sn_cyclesources);	free(psn->sn_cyclebuf);	/* assume no mutexes held at this point */	pthread_cond_destroy(&psn->sn_cond);	pthread_mutex_destroy(&psn->sn_mutex);	pthread_mutex_destroy(&psn->sn_rtpthrmutex);	pthread_mutex_destroy(&psn->sn_rtcpthrmutex);	pthread_mutex_destroy(&psn->sn_rtcpcyclethrmutex);	pthread_mutex_destroy(&psn->sn_getstreammutex);	pthread_mutex_destroy(&psn->sn_cnamemutex);	free(psn);	return OK;}

⌨️ 快捷键说明

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