完善hls播放器个数计数

This commit is contained in:
xiongziliang
2019-12-28 16:57:35 +08:00
parent f93b32740f
commit e72fa359b6
7 changed files with 15 additions and 4 deletions

View File

@@ -175,7 +175,7 @@ private:
void onReaderChanged(int size) {
//我们记录最后一次活动时间
_reader_changed_ticker.resetTime();
if (size != 0 || readerCount() != 0) {
if (size != 0 || totalReaderCount() != 0) {
//还有消费者正在观看该流
_async_emit_none_reader = false;
return;

View File

@@ -302,7 +302,7 @@ void RtmpSession::sendPlayResponse(const string &err,const RtmpMediaSource::Ptr
strongSelf->shutdown(SockException(Err_shutdown,"rtmp ring buffer detached"));
});
_pPlayerSrc = src;
if (src->readerCount() == 1) {
if (src->totalReaderCount() == 1) {
src->seekTo(0);
}
//提高服务器发送性能

View File

@@ -195,7 +195,7 @@ private:
void onReaderChanged(int size) {
//我们记录最后一次活动时间
_reader_changed_ticker.resetTime();
if (size != 0 || readerCount() != 0) {
if (size != 0 || totalReaderCount() != 0) {
//还有消费者正在观看该流
_async_emit_none_reader = false;
return;

View File

@@ -773,7 +773,7 @@ void RtspSession::handleReq_Play(const Parser &parser) {
auto iStartTime = 1000 * atof(strStart.data());
InfoP(this) << "rtsp seekTo(ms):" << iStartTime;
useBuf = !pMediaSrc->seekTo(iStartTime);
}else if(pMediaSrc->readerCount() == 0){
}else if(pMediaSrc->totalReaderCount() == 0){
//第一个消费者
pMediaSrc->seekTo(0);
}