www.pudn.com > streamrtp.rar > rtpstreamon.c


/*-------------------------------------------------------------------------
 * rtpstreamon.c - rtpstreamon
 *-------------------------------------------------------------------------
 */

#include 

/*------------------------------------------------------------------------
 * rtpstreamon - begin enqueuing packets for a particular stream.
 * The parameter clockrate is the stream's media clockrate in Hz.
 * The clockrate is necessary at the RTP layer to computer jitter stats.
 *------------------------------------------------------------------------
 */
int
rtpstreamon(struct session *psn, ssrc_t ssrc, unsigned int clockrate)
{

	struct stream *pstm;

	pstm = rtpgetstream(psn, ssrc);

	if (pstm == NULL) 
		return ERROR;

	if (pstm->stm_enqueue == TRUE) {
		/* 
		 * Return ERROR if stream is already ``on''.
		 */
		rtpreleasestream(psn, pstm);
		return ERROR;
	}

	pstm->stm_clkrt = clockrate;
	pstm->stm_enqueue = TRUE;
	rtpreleasestream(psn, pstm);

	return OK;
}