Ejemplo n.º 1
0
/**
 * Sends a RTCP bye packet.
 *@param session RtpSession
 *@param reason the reason phrase.
**/
int rtp_session_bye(RtpSession *session, const char *reason) {
    mblk_t *cm;
    mblk_t *sdes = NULL;
    mblk_t *bye = NULL;
    int ret;

    /* Make a BYE packet (will be on the end of the compund packet). */
    bye = rtcp_create_simple_bye_packet(session->snd.ssrc, reason);

    /* SR or RR is determined by the fact whether stream was sent*/
    if (session->stats.packet_sent>0)
    {
        cm = allocb(sizeof(rtcp_sr_t), 0);
        cm->b_wptr += rtcp_sr_init(session,cm->b_wptr, sizeof(rtcp_sr_t));
        /* make a SDES packet */
        sdes = rtp_session_create_rtcp_sdes_packet(session, TRUE);
        /* link them */
        concatb(concatb(cm, sdes), bye);
    } else if (session->stats.packet_recv>0){
        /* make a RR packet */
        cm = allocb(sizeof(rtcp_rr_t), 0);
        cm->b_wptr += rtcp_rr_init(session, cm->b_wptr, sizeof(rtcp_rr_t));
        /* link them */
        cm->b_cont = bye;
    }else cm=bye;

    /* Send compound packet. */
    ret = rtp_session_rtcp_send(session, cm);

    return ret;
}
Ejemplo n.º 2
0
static mblk_t * make_rr(RtpSession *session){
	mblk_t *cm=NULL;
	mblk_t *sdes=NULL;
	
	cm=allocb(sizeof(rtcp_sr_t),0);
	cm->b_wptr+=rtcp_rr_init(session,cm->b_wptr,sizeof(rtcp_rr_t));
	/* make a SDES packet */
	if (session->sd!=NULL)
		sdes=rtp_session_create_rtcp_sdes_packet(session);
	/* link them */
	cm->b_cont=sdes;
	return cm;
}
Ejemplo n.º 3
0
void __rtp_session_rtcp_process(RtpSession *session){
	mblk_t *cm=NULL;
	mblk_t *sdes=NULL;
	if (session->mode==RTP_SESSION_SENDONLY || session->mode==RTP_SESSION_SENDRECV){
		/* first make a SR packet */
		cm=allocb(sizeof(rtcp_sr_t),0);
		cm->b_wptr+=rtcp_sr_init(session,cm->b_wptr,sizeof(rtcp_sr_t));
		/* make a SDES packet */
		sdes=rtp_session_create_rtcp_sdes_packet(session);
		/* link them */
		cm->b_cont=sdes;
	}else{
		/* make a RR packet */
		cm=allocb(sizeof(rtcp_rr_t),0);
		cm->b_wptr+=rtcp_rr_init(session,cm->b_wptr,sizeof(rtcp_rr_t));
		/* if we are recv-only do we need to add SDES packet ? I don't think so
		as we are not a source	*/
	}
	/* send the compound packet */
	ortp_rtcp_send(session,cm);
	ortp_debug("Rtcp compound message sent.");
}
Ejemplo n.º 4
0
static mblk_t * make_rr(RtpSession *session) {
	mblk_t *cm = allocb(sizeof(rtcp_sr_t), 0);
	cm->b_wptr += rtcp_rr_init(session, cm->b_wptr, sizeof(rtcp_rr_t));
	return cm;
}