RTP fix..?

This commit is contained in:
Thulinma 2019-02-06 15:51:01 +01:00
parent c0f72a9b75
commit 39aa3bde3f

View file

@ -311,22 +311,13 @@ namespace RTP{
rtcpData[1] = 200; // sender report rtcpData[1] = 200; // sender report
Bit::htobs(rtcpData + 2, 6); // 6 4-byte words follow the header Bit::htobs(rtcpData + 2, 6); // 6 4-byte words follow the header
Bit::htobl(rtcpData + 4, getSSRC()); // set source identifier Bit::htobl(rtcpData + 4, getSSRC()); // set source identifier
// timestamp in ms
double ntpTime = 2208988800UL + Util::epoch() + (Util::getMS() % 1000) / 1000.0;
if (startRTCP < 1 && startRTCP > -1){startRTCP = ntpTime;}
ntpTime -= startRTCP;
((int *)rtcpData)[2] = htonl(2208988800UL + Util::epoch()); // epoch is in seconds Bit::htobll(rtcpData + 8, Util::getNTP());
((int *)rtcpData)[3] = htonl((Util::getMS() % 1000) * 4294967.295); Bit::htobl(rtcpData + 16, getTimeStamp()); // rtpts
if (metadata.tracks[tid].codec == "H264"){
((int *)rtcpData)[4] = htonl((ntpTime - 0) * 90000); // rtpts
}else{
((int *)rtcpData)[4] = htonl((ntpTime - 0) * metadata.tracks[tid].rate); // rtpts
}
// it should be the time packet was sent maybe, after all? // it should be the time packet was sent maybe, after all?
//*((int *)(rtcpData+16) ) = htonl(getTimeStamp());//rtpts //*((int *)(rtcpData+16) ) = htonl(getTimeStamp());//rtpts
((int *)rtcpData)[5] = htonl(sentPackets); // packet Bit::htobl(rtcpData + 20, sentPackets); // packet
((int *)rtcpData)[6] = htonl(sentBytes); // octet Bit::htobl(rtcpData + 24, sentBytes); // octet
callBack(socket, (char *)rtcpData, 28, 0); callBack(socket, (char *)rtcpData, 28, 0);
free(rtcpData); free(rtcpData);
} }
@ -966,7 +957,6 @@ namespace RTP{
return; return;
case 5:{ case 5:{
// @todo add check if ppsData and spsData are not empty? // @todo add check if ppsData and spsData are not empty?
size_t needed_bytes = len + ppsData.size() + spsData.size() + 8;
static Util::ResizeablePointer tmp; static Util::ResizeablePointer tmp;
tmp.assign(0, 0); tmp.assign(0, 0);
@ -1009,8 +999,6 @@ namespace RTP{
outPacket(nextPack); outPacket(nextPack);
return; return;
} }
return;
default: // others, continue parsing default: // others, continue parsing
break; break;
} }