- Timestamp:
- 08/21/10 19:30:35 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/thelib/src/protocols/rtp/connectivity/outboundconnectivity.cpp
r49 r87 305 305 //uint16_t seq = ntohsp(((uint8_t *) message.msg_iov[0].iov_base) + 2); 306 306 //FINEST("seq: %d", seq); 307 if ((_videoPacketsCount % 300) == 0) { 308 /* 309 0 1 2 3 310 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 311 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 312 |V=2|P| RC | PT=SR=200 | length | header 313 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 314 | SSRC of sender | 315 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 316 | NTP timestamp, most significant word | sender 317 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ info 318 | NTP timestamp, least significant word | 319 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 320 | RTP timestamp | 321 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 322 | sender's packet count | 323 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 324 | sender's octet count | 325 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 326 */ 327 328 WARN("Video: MUST send SR to %d clients", _udpVideoRTCPClients.size()); 307 if (((_videoPacketsCount % 300) == 0) || _videoPacketsCount == 1) { 329 308 uint8_t buff[28]; 330 buff[0] = 0x80; //V,P,RC 331 buff[1] = 0xc8; //PT 332 buff[2] = 0x00; //length 333 buff[3] = 0x06; //length 334 uint32_t ssrc = _pOutStream->SSRC(); 335 put_htonl(buff + 4, ssrc); //SSRC 336 uint64_t ntp; 337 GETNTP(ntp); 338 put_htonll(buff + 8, ntp); //NTP 339 double rtpDouble; 340 GETCLOCKS(rtpDouble); 341 // ASSERT("_pOutStream->GetCapabilities()->audioCodecInfo.aac.sampleRate: %d", 342 // _pOutStream->GetCapabilities()->audioCodecInfo.aac.sampleRate); 343 put_htonl(buff + 16, (uint32_t) (rtpDouble / CLOCKS_PER_SEC) 344 * _pOutStream->GetCapabilities()->audioCodecInfo.aac.sampleRate); //RTP ts 345 put_htonl(buff + 20, _videoPacketsCount); //sender's packet count 346 put_htonl(buff + 24, _videoBytesCount); //sender's octet count 347 309 CreateRTCPPacket(buff, 310 (uint8_t *) message.msg_iov[0].iov_base, 311 _pOutStream->SSRC(), 312 90000, 313 _videoPacketsCount, 314 _videoBytesCount, 315 false); 348 316 _message.msg_iov[0].iov_base = buff; 349 317 _message.msg_iov[0].iov_len = 28; … … 365 333 //uint16_t seq = ntohsp(((uint8_t *) message.msg_iov[0].iov_base) + 2); 366 334 //FINEST("seq: %d", seq); 367 if ((_audioPacketsCount % 300) == 0) { 368 /* 369 0 1 2 3 370 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 371 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 372 |V=2|P| RC | PT=SR=200 | length | header 373 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 374 | SSRC of sender | 375 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 376 | NTP timestamp, most significant word | sender 377 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ info 378 | NTP timestamp, least significant word | 379 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 380 | RTP timestamp | 381 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 382 | sender's packet count | 383 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 384 | sender's octet count | 385 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 386 */ 387 388 WARN("Audio: MUST send SR to %d clients", _udpAudioRTCPClients.size()); 335 if (((_audioPacketsCount % 300) == 0) || (_audioPacketsCount == 1)) { 389 336 uint8_t buff[28]; 390 buff[0] = 0x80; //V,P,RC 391 buff[1] = 0xc8; //PT 392 buff[2] = 0x00; //length 393 buff[3] = 0x06; //length 394 uint32_t ssrc = _pOutStream->SSRC(); 395 put_htonl(buff + 4, ssrc); //SSRC 396 uint64_t ntp; 397 GETNTP(ntp); 398 put_htonll(buff + 8, ntp); //NTP 399 double rtpDouble; 400 GETCLOCKS(rtpDouble); 401 put_htonl(buff + 16, (uint32_t) (rtpDouble / CLOCKS_PER_SEC)*1000 * 90); //RTP ts 402 put_htonl(buff + 20, _audioPacketsCount); //sender's packet count 403 put_htonl(buff + 24, _audioBytesCount); //sender's octet count 404 337 CreateRTCPPacket(buff, 338 (uint8_t *) message.msg_iov[0].iov_base, 339 _pOutStream->SSRC(), 340 _pOutStream->GetCapabilities()->audioCodecInfo.aac.sampleRate, 341 _audioPacketsCount, 342 _audioBytesCount, 343 true); 405 344 _message.msg_iov[0].iov_base = buff; 406 345 _message.msg_iov[0].iov_len = 28; … … 415 354 return true; 416 355 } 356 357 bool OutboundConnectivity::CreateRTCPPacket(uint8_t *pDest, uint8_t *pSrc, 358 uint32_t ssrc, uint32_t rate, uint32_t packetsCount, uint32_t bytesCount, 359 bool isAudio) { 360 361 /* 362 0 1 2 3 363 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 364 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 365 |V=2|P| RC | PT=SR=200 | length | header 366 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 367 | SSRC of sender | 368 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 369 | NTP timestamp, most significant word | sender 370 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ info 371 | NTP timestamp, least significant word | 372 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 373 | RTP timestamp | 374 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 375 | sender's packet count | 376 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 377 | sender's octet count | 378 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 379 */ 380 381 // WARN("%s: MUST send SR to %d clients", 382 // isAudio ? "Audio" : "Video", 383 // _udpVideoRTCPClients.size()); 384 385 //1. V,P,RC 386 pDest[0] = 0x80; 387 388 //2. PT 389 pDest[1] = 0xc8; 390 391 //3. Length 392 pDest[2] = 0x00; 393 pDest[3] = 0x06; 394 395 //4. ssrc 396 put_htonl(pDest + 4, ssrc); //SSRC 397 398 //5. NTP 399 uint64_t ntp; 400 //GETCUSTOMNTP(ntp, (ntohlp(pSrc + 4) / rate)*1000); 401 GETNTP(ntp); 402 put_htonll(pDest + 8, ntp); 403 404 //6. RTP 405 memcpy(pDest + 16, pSrc + 4, 4); 406 407 //7. sender's packet count 408 put_htonl(pDest + 20, packetsCount); 409 410 //8. sender's octet count 411 put_htonl(pDest + 24, bytesCount); 412 413 return true; 414 } 415 417 416 #endif /* HAS_PROTOCOL_RTP */
Note: See TracChangeset
for help on using the changeset viewer.
