From 39aa3bde3f7aa8a773bdedba867679bc1bf51b85 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 6 Feb 2019 15:51:01 +0100 Subject: [PATCH] RTP fix..? --- lib/rtp.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/rtp.cpp b/lib/rtp.cpp index efdfa345..18cc0e1f 100644 --- a/lib/rtp.cpp +++ b/lib/rtp.cpp @@ -311,22 +311,13 @@ namespace RTP{ rtcpData[1] = 200; // sender report Bit::htobs(rtcpData + 2, 6); // 6 4-byte words follow the header 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 - ((int *)rtcpData)[3] = htonl((Util::getMS() % 1000) * 4294967.295); - 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 - } + Bit::htobll(rtcpData + 8, Util::getNTP()); + Bit::htobl(rtcpData + 16, getTimeStamp()); // rtpts // it should be the time packet was sent maybe, after all? //*((int *)(rtcpData+16) ) = htonl(getTimeStamp());//rtpts - ((int *)rtcpData)[5] = htonl(sentPackets); // packet - ((int *)rtcpData)[6] = htonl(sentBytes); // octet + Bit::htobl(rtcpData + 20, sentPackets); // packet + Bit::htobl(rtcpData + 24, sentBytes); // octet callBack(socket, (char *)rtcpData, 28, 0); free(rtcpData); } @@ -966,7 +957,6 @@ namespace RTP{ return; case 5:{ // @todo add check if ppsData and spsData are not empty? - size_t needed_bytes = len + ppsData.size() + spsData.size() + 8; static Util::ResizeablePointer tmp; tmp.assign(0, 0); @@ -1009,8 +999,6 @@ namespace RTP{ outPacket(nextPack); return; } - - return; default: // others, continue parsing break; }