Commit d26b7512 by xiongziliang

修复hls播放器流量统计不准确的bug

parent 1e1b3794
......@@ -48,8 +48,9 @@ HlsCookieData::~HlsCookieData() {
<< ")断开,耗时(s):" << duration;
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
if (_bytes > iFlowThreshold * 1024) {
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _info, _bytes, duration, true, static_cast<SockInfo&>(*_sock_info));
uint64_t bytes = _bytes.load();
if (bytes > iFlowThreshold * 1024) {
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _info, bytes, duration, true, static_cast<SockInfo&>(*_sock_info));
}
}
}
......
......@@ -103,10 +103,12 @@ public:
HlsCookieData(const MediaInfo &info, const std::shared_ptr<SockInfo> &sock_info);
~HlsCookieData();
void addByteUsage(uint64_t bytes);
private:
void addReaderCount();
private:
uint64_t _bytes = 0;
atomic<uint64_t> _bytes {0};
MediaInfo _info;
std::shared_ptr<bool> _added;
weak_ptr<HlsMediaSource> _src;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论