mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-26 03:42:21 +08:00
Add network traffic statistics (#4239)
Co-authored-by: xiongguangjie <xiong_panda@163.com> Co-authored-by: xia-chu <771730766@qq.com>
This commit is contained in:
@@ -800,7 +800,7 @@ void RtspPlayer::onPlayResult_l(const SockException &ex, bool handshake_done) {
|
||||
};
|
||||
// 创建rtp数据接收超时检测定时器 [AUTO-TRANSLATED:edbffc19]
|
||||
// Create RTP data receive timeout detection timer
|
||||
_rtp_check_timer = std::make_shared<Timer>(timeoutMS / 2000.0f, lam, getPoller());
|
||||
_rtp_check_timer = std::make_shared<Timer>(timeoutMS / 2000.0f, std::move(lam), getPoller());
|
||||
} else {
|
||||
sendTeardown();
|
||||
}
|
||||
@@ -844,6 +844,36 @@ int RtspPlayer::getTrackIndexByTrackType(TrackType track_type) const {
|
||||
throw SockException(Err_other, StrPrinter << "no such track with type:" << getTrackString(track_type));
|
||||
}
|
||||
|
||||
size_t RtspPlayer::getRecvSpeed() {
|
||||
size_t ret = TcpClient::getRecvSpeed();
|
||||
for (auto &rtp : _rtp_sock) {
|
||||
if (rtp) {
|
||||
ret += rtp->getRecvSpeed();
|
||||
}
|
||||
}
|
||||
for (auto &rtcp : _rtcp_sock) {
|
||||
if (rtcp) {
|
||||
ret += rtcp->getRecvSpeed();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t RtspPlayer::getRecvTotalBytes() {
|
||||
size_t ret = TcpClient::getRecvTotalBytes();
|
||||
for (auto &rtp : _rtp_sock) {
|
||||
if (rtp) {
|
||||
ret += rtp->getRecvTotalBytes();
|
||||
}
|
||||
}
|
||||
for (auto &rtcp : _rtcp_sock) {
|
||||
if (rtcp) {
|
||||
ret += rtcp->getRecvTotalBytes();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
// RtspPlayerImp
|
||||
float RtspPlayerImp::getDuration() const {
|
||||
|
||||
Reference in New Issue
Block a user