mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-23 18:17:49 +08:00
update webrtc/WebRtcTransport.cpp.
This commit is contained in:
parent
e299832f61
commit
c5a6916378
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
||||||
@ -612,6 +612,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getLossRate() {
|
int getLossRate() {
|
||||||
|
if (!_rtcp_context.getExpectedPacketsInterval()) //_rtcp_context.getExpectedPacketsInterval()取值总为零?
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return _rtcp_context.geLostInterval() * 100 / _rtcp_context.getExpectedPacketsInterval();
|
return _rtcp_context.geLostInterval() * 100 / _rtcp_context.getExpectedPacketsInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,6 +659,21 @@ std::shared_ptr<RtpChannel> MediaTrack::getRtpChannel(uint32_t ssrc) const{
|
|||||||
return it_chn->second;
|
return it_chn->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WebRtcTransportImp::getLossRate(mediakit::TrackType type){
|
||||||
|
for(auto it : _ssrc_to_track){
|
||||||
|
auto ssrc = it.first;
|
||||||
|
auto track = it.second;
|
||||||
|
auto rtp_chn = track->getRtpChannel(ssrc);
|
||||||
|
if(rtp_chn){
|
||||||
|
InfoL << "-----------接收丢包率,ssrc------------- :" << ssrc << ",loss rate(%):" << rtp_chn->getLossRate() ;
|
||||||
|
if (track->media && type==track->media->type){
|
||||||
|
return rtp_chn->getLossRate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void WebRtcTransportImp::onRtcp(const char *buf, size_t len) {
|
void WebRtcTransportImp::onRtcp(const char *buf, size_t len) {
|
||||||
_bytes_usage += len;
|
_bytes_usage += len;
|
||||||
auto rtcps = RtcpHeader::loadFromBytes((char *) buf, len);
|
auto rtcps = RtcpHeader::loadFromBytes((char *) buf, len);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user