Commit c3302eec by xiongziliang

优化hls播放器计数

parent 97ad062d
......@@ -39,6 +39,7 @@ void HlsCookieData::addReaderCount(){
if(src){
src->modifyReaderCount(true);
_added = true;
_src = src;
}
}
......@@ -46,7 +47,7 @@ void HlsCookieData::addReaderCount(){
HlsCookieData::~HlsCookieData() {
if(_added){
auto src = dynamic_pointer_cast<HlsMediaSource>(MediaSource::find(HLS_SCHEMA,_info._vhost,_info._app,_info._streamid));
auto src = _src.lock();
if(src){
src->modifyReaderCount(false);
}
......
......@@ -30,6 +30,7 @@
#include "Common/MediaSource.h"
namespace mediakit{
class HlsMediaSource;
class HlsCookieData{
public:
HlsCookieData(const MediaInfo &info);
......@@ -41,6 +42,7 @@ private:
uint64_t _bytes = 0;
MediaInfo _info;
bool _added = false;
weak_ptr<HlsMediaSource> _src;
};
class HlsMediaSource : public MediaSource {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论