优化hls播放器计数

This commit is contained in:
xiongziliang 2019-12-29 13:38:16 +08:00
parent 97ad062dcf
commit c3302eec1e
2 changed files with 4 additions and 1 deletions

View File

@ -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);
}

View File

@ -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 {