实现rtsp/rtmp按需转协议功能

This commit is contained in:
xiongziliang
2020-09-12 19:09:56 +08:00
parent aff9963f95
commit 9e26a02fb1
23 changed files with 170 additions and 153 deletions

View File

@@ -26,7 +26,7 @@ public:
_ring = std::make_shared<RingType>();
}
virtual ~HlsMediaSource() = default;
~HlsMediaSource() override = default;
/**
* 获取媒体源的环形缓冲
@@ -47,10 +47,10 @@ public:
* 注册hls
*/
void registHls(){
if(!_registed){
regist();
if (!_registed) {
_registed = true;
onNoneReader();
onReaderChanged(0);
regist();
}
}
@@ -62,12 +62,10 @@ private:
void modifyReaderCount(bool add) {
if (add) {
++_readerCount;
return;
}
if (--_readerCount == 0) {
onNoneReader();
} else {
--_readerCount;
}
onReaderChanged(_readerCount);
}
private:
atomic_int _readerCount;