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:
PioLing
2025-05-02 16:23:25 +08:00
committed by GitHub
parent ab14adb94d
commit 7b1f8fedac
35 changed files with 325 additions and 19 deletions

View File

@@ -110,13 +110,20 @@ std::shared_ptr<void> MediaSource::getOwnership() {
});
}
int MediaSource::getBytesSpeed(TrackType type){
size_t MediaSource::getBytesSpeed(TrackType type) {
if(type == TrackInvalid || type == TrackMax){
return _speed[TrackVideo].getSpeed() + _speed[TrackAudio].getSpeed();
}
return _speed[type].getSpeed();
}
size_t MediaSource::getTotalBytes(TrackType type) {
if (type == TrackInvalid || type == TrackMax) {
return _speed[TrackVideo].getTotalBytes() + _speed[TrackAudio].getTotalBytes();
}
return _speed[type].getTotalBytes();
}
uint64_t MediaSource::getAliveSecond() const {
// 使用Ticker对象获取存活时间的目的是防止修改系统时间导致回退 [AUTO-TRANSLATED:68474061]
// The purpose of using the Ticker object to obtain the survival time is to prevent the modification of the system time from causing a rollback