Revision 5e9e29e0 rtcp.c

View differences:

rtcp.c
90 90
				}
91 91
				break;
92 92
			}
93
			case RTCP_FIR: {
94
				/* FIR, rfc2032 */
95
				JANUS_PRINT("     #%d FIR (192)\n", pno);
96
				rtcp_fb *rtcpfb = (rtcp_fb *)rtcp;
97
				if(fixssrc && newssrcr && (ntohs(rtcp->length) >= 20)) {
98
					rtcpfb->media = htonl(newssrcr);
99
				}
100
				if(fixssrc && newssrcr) {
101
					uint32_t *ssrc = (uint32_t *)rtcpfb->fci;
102
					*ssrc = htonl(newssrcr);
103
				}
104
				break;
105
			}
93 106
			case RTCP_RTPFB: {
94 107
				/* RTPFB, Transport layer FB message (rfc4585) */
95 108
				//~ JANUS_PRINT("     #%d RTPFB (205)\n", pno);
......
398 411
	return 0;
399 412
}
400 413

  
414
/* Generate a new legacy FIR message */
415
int janus_rtcp_fir_legacy(char *packet, int len, int *seqnr) {
416
	/* FIXME Right now, this is identical to the new FIR, with the difference that we use 192 as PT */
417
	if(packet == NULL || len != 20 || seqnr == NULL)
418
		return -1;
419
	rtcp_header *rtcp = (rtcp_header *)packet;
420
	*seqnr = *seqnr + 1;
421
	if(*seqnr < 0 || *seqnr >= 256)
422
		*seqnr = 0;	/* Reset sequence number */
423
	/* Set header */
424
	rtcp->version = 2;
425
	rtcp->type = RTCP_FIR;
426
	rtcp->rc = 4;	/* FMT=4 */
427
	rtcp->length = htons((len/4)-1);
428
	/* Now set FIR stuff */
429
	rtcp_fb *rtcpfb = (rtcp_fb *)rtcp;
430
	rtcp_fir *fir = (rtcp_fir *)rtcpfb->fci;
431
	fir->seqnr = htonl(*seqnr << 24);	/* FCI: Sequence number */
432
	JANUS_PRINT("[FIR] seqnr=%d (%d bytes)\n", *seqnr, 4*(ntohs(rtcp->length)+1));
433
	return 0;
434
}
435

  
401 436
/* Generate a new PLI message */
402 437
int janus_rtcp_pli(char *packet, int len) {
403 438
	if(packet == NULL || len != 12)

Also available in: Unified diff