mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-27 04:20:13 +08:00
优化hls播放器计数
This commit is contained in:
parent
97ad062dcf
commit
c3302eec1e
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user