本文整理汇总了C++中RtcpHeader::setLostPackets方法的典型用法代码示例。如果您正苦于以下问题:C++ RtcpHeader::setLostPackets方法的具体用法?C++ RtcpHeader::setLostPackets怎么用?C++ RtcpHeader::setLostPackets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RtcpHeader
的用法示例。
在下文中一共展示了RtcpHeader::setLostPackets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkRtcpFb
void RtcpAggregator::checkRtcpFb() {
boost::mutex::scoped_lock mlock(mapLock_);
std::map<uint32_t, boost::shared_ptr<RtcpData>>::iterator it;
for (it = rtcpData_.begin(); it != rtcpData_.end(); it++) {
boost::shared_ptr<RtcpData> rtcpData = it->second;
boost::mutex::scoped_lock lock(rtcpData->dataLock);
uint32_t sourceSsrc = it->first;
uint32_t sinkSsrc;
uint64_t now = ClockUtils::timePointToMs(clock::now());
unsigned int dt = now - rtcpData->last_rr_sent;
unsigned int edlsr = now - rtcpData->last_sr_updated;
unsigned int dt_scheduled = now - rtcpData->last_rr_was_scheduled;
// Generate Full RTCP Packet
if ((rtcpData->requestRr || dt >= rtcpData->nextPacketInMs ||rtcpData->shouldSendREMB) && rtcpData->lastSr > 0) {
rtcpData->requestRr = false;
RtcpHeader rtcpHead;
rtcpHead.setPacketType(RTCP_Receiver_PT);
if (sourceSsrc == rtcpSource_->getAudioSourceSSRC()) {
sinkSsrc = rtcpSink_->getAudioSinkSSRC();
ELOG_DEBUG("Sending Audio RR: PacketLost %u, Ratio %u, DLSR %u"
", lastSR %u, DLSR Adjusted %u dt %u, rrsSinceLast %u highestSeqNum %u",
rtcpData->totalPacketsLost,
rtcpData->ratioLost,
rtcpData->delaySinceLastSr,
rtcpData->lastSr,
(rtcpData->delaySinceLastSr+edlsr),
dt,
rtcpData->rrsReceivedInPeriod,
rtcpData->highestSeqNumReceived);
rtcpHead.setSSRC(rtcpSink_->getAudioSinkSSRC());
rtcpHead.setSourceSSRC(rtcpSource_->getAudioSourceSSRC());
} else {
sinkSsrc = rtcpSink_->getVideoSinkSSRC();
ELOG_DEBUG("Sending Video RR: SOurcessrc %u sinkSsrc %u PacketLost %u, Ratio %u, DLSR %u, lastSR %u"
", DLSR Adjusted %u dt %u, rrsSinceLast %u highestSeqNum %u jitter %u",
sourceSsrc,
rtcpSink_->getVideoSinkSSRC(),
rtcpData->totalPacketsLost,
rtcpData->ratioLost,
rtcpData->delaySinceLastSr,
rtcpData->lastSr,
(rtcpData->delaySinceLastSr+edlsr),
dt, rtcpData->rrsReceivedInPeriod,
rtcpData->highestSeqNumReceived,
rtcpData->jitter);
rtcpHead.setSSRC(rtcpSink_->getVideoSinkSSRC());
rtcpHead.setSourceSSRC(rtcpSource_->getVideoSourceSSRC());
}
// rtcpHead.setFractionLost(rtcpData->ratioLost);
// Calculate ratioLost
uint32_t packetsReceivedinInterval = rtcpData->extendedSeqNo - rtcpData->prevExtendedSeqNo;
uint32_t packetsLostInInterval = rtcpData->totalPacketsLost - rtcpData->prevTotalPacketsLost;
double ratio = static_cast<double>(packetsLostInInterval/packetsReceivedinInterval);
rtcpHead.setFractionLost(ratio*256);
rtcpData->prevTotalPacketsLost = rtcpData->totalPacketsLost;
rtcpData->prevExtendedSeqNo = rtcpData->extendedSeqNo;
rtcpHead.setHighestSeqnum(rtcpData->highestSeqNumReceived);
rtcpHead.setSeqnumCycles(rtcpData->seqNumCycles);
rtcpHead.setLostPackets(rtcpData->totalPacketsLost);
rtcpHead.setJitter(rtcpData->jitter);
rtcpHead.setLastSr(rtcpData->lastSr);
rtcpHead.setDelaySinceLastSr(rtcpData->delaySinceLastSr + ((edlsr*65536)/1000));
rtcpHead.setLength(7);
rtcpHead.setBlockCount(1);
int length = (rtcpHead.getLength()+1)*4;
memcpy(packet_, reinterpret_cast<uint8_t*>(&rtcpHead), length);
if (rtcpData->shouldSendNACK) {
ELOG_DEBUG("SEND NACK, SENDING with Seqno: %u", rtcpData->nackSeqnum);
int theLen = this->addNACK(reinterpret_cast<char*>(packet_), length, rtcpData->nackSeqnum,
rtcpData->nackBlp, sourceSsrc, sinkSsrc);
rtcpData->shouldSendNACK = false;
rtcpData->nackSeqnum = 0;
rtcpData->nackBlp = 0;
length = theLen;
}
if (rtcpData->mediaType == VIDEO_TYPE) {
unsigned int sincelastREMB = now - rtcpData->last_remb_sent;
if (sincelastREMB > REMB_TIMEOUT) {
// We dont have any more RRs, we follow what the publisher is doing to avoid congestion
rtcpData->shouldSendREMB = true;
}
if (rtcpData->shouldSendREMB) {
ELOG_DEBUG("Sending REMB, since last %u ms, sending with BW: %lu",
sincelastREMB, rtcpData->reportedBandwidth);
int theLen = this->addREMB(reinterpret_cast<char*>(packet_), length, rtcpData->reportedBandwidth);
rtcpData->shouldSendREMB = false;
rtcpData->last_remb_sent = now;
length = theLen;
}
}
if (rtcpSource_->isVideoSourceSSRC(sourceSsrc)) {
rtcpSink_->deliverVideoData(std::make_shared<DataPacket>(0, reinterpret_cast<char*>(packet_),
length, VIDEO_PACKET));
} else {
rtcpSink_->deliverAudioData(std::make_shared<DataPacket>(0, reinterpret_cast<char*>(packet_),
//.........这里部分代码省略.........