mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
优化hls播放器计数
This commit is contained in:
parent
97ad062dcf
commit
c3302eec1e
@ -39,6 +39,7 @@ void HlsCookieData::addReaderCount(){
|
|||||||
if(src){
|
if(src){
|
||||||
src->modifyReaderCount(true);
|
src->modifyReaderCount(true);
|
||||||
_added = true;
|
_added = true;
|
||||||
|
_src = src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ void HlsCookieData::addReaderCount(){
|
|||||||
|
|
||||||
HlsCookieData::~HlsCookieData() {
|
HlsCookieData::~HlsCookieData() {
|
||||||
if(_added){
|
if(_added){
|
||||||
auto src = dynamic_pointer_cast<HlsMediaSource>(MediaSource::find(HLS_SCHEMA,_info._vhost,_info._app,_info._streamid));
|
auto src = _src.lock();
|
||||||
if(src){
|
if(src){
|
||||||
src->modifyReaderCount(false);
|
src->modifyReaderCount(false);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "Common/MediaSource.h"
|
#include "Common/MediaSource.h"
|
||||||
namespace mediakit{
|
namespace mediakit{
|
||||||
|
|
||||||
|
class HlsMediaSource;
|
||||||
class HlsCookieData{
|
class HlsCookieData{
|
||||||
public:
|
public:
|
||||||
HlsCookieData(const MediaInfo &info);
|
HlsCookieData(const MediaInfo &info);
|
||||||
@ -41,6 +42,7 @@ private:
|
|||||||
uint64_t _bytes = 0;
|
uint64_t _bytes = 0;
|
||||||
MediaInfo _info;
|
MediaInfo _info;
|
||||||
bool _added = false;
|
bool _added = false;
|
||||||
|
weak_ptr<HlsMediaSource> _src;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HlsMediaSource : public MediaSource {
|
class HlsMediaSource : public MediaSource {
|
||||||
|
Loading…
Reference in New Issue
Block a user