实现hls的流量汇报事件

This commit is contained in:
xiongziliang
2019-12-29 15:38:29 +08:00
parent e951efc615
commit e91c26c052
11 changed files with 91 additions and 78 deletions

View File

@@ -42,21 +42,27 @@ void HlsCookieData::addReaderCount(){
_src = src;
}
}
}
HlsCookieData::~HlsCookieData() {
if(_added){
if (_added) {
auto src = _src.lock();
if(src){
if (src) {
src->modifyReaderCount(false);
}
auto duration = (_ticker.createdTime() - _ticker.elapsedTime()) / 1000;
WarnL << "HLS播放器(" << _info._vhost << "/" << _info._app << "/" << _info._streamid << ")断开,播放时间:" << duration;
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
if (_bytes > iFlowThreshold * 1024) {
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _info, _bytes, duration, true);
}
}
}
void HlsCookieData::addByteUsage(uint64_t bytes) {
addReaderCount();
_bytes += bytes;
_ticker.resetTime();
}