mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
修复开启转协议后,无人观看掐流延时不定期的bug
This commit is contained in:
parent
f881108dfe
commit
e76bc65243
@ -240,6 +240,15 @@ int FFmpegSource::totalReaderCount(MediaSource &sender) {
|
||||
return sender.readerCount();
|
||||
}
|
||||
|
||||
void FFmpegSource::onNoneReader(MediaSource &sender){
|
||||
auto listener = _listener.lock();
|
||||
if(listener){
|
||||
listener->onNoneReader(sender);
|
||||
return;
|
||||
}
|
||||
MediaSourceEvent::onNoneReader(sender);
|
||||
}
|
||||
|
||||
void FFmpegSource::onGetMediaSource(const MediaSource::Ptr &src) {
|
||||
_listener = src->getListener();
|
||||
src->setListener(shared_from_this());
|
||||
|
@ -61,6 +61,8 @@ private:
|
||||
//MediaSourceEvent override
|
||||
bool close(MediaSource &sender,bool force) override;
|
||||
int totalReaderCount(MediaSource &sender) override;
|
||||
void onNoneReader(MediaSource &sender) override;
|
||||
|
||||
private:
|
||||
Process _process;
|
||||
Timer::Ptr _timer;
|
||||
|
@ -53,9 +53,9 @@ public:
|
||||
virtual bool setupRecord(MediaSource &sender, Recorder::type type, bool start, const string &custom_path) { return false; };
|
||||
// 获取录制状态
|
||||
virtual bool isRecording(MediaSource &sender, Recorder::type type) { return false; };
|
||||
private:
|
||||
// 通知无人观看
|
||||
void onNoneReader(MediaSource &sender);
|
||||
virtual void onNoneReader(MediaSource &sender);
|
||||
|
||||
private:
|
||||
Timer::Ptr _async_close_timer;
|
||||
};
|
||||
|
@ -278,6 +278,15 @@ int MultiMediaSourceMuxer::totalReaderCount(MediaSource &sender) {
|
||||
return listener->totalReaderCount(sender);
|
||||
}
|
||||
|
||||
void MultiMediaSourceMuxer::onNoneReader(MediaSource &sender){
|
||||
auto listener = _listener.lock();
|
||||
if (!listener) {
|
||||
MediaSourceEvent::onNoneReader(sender);
|
||||
return;
|
||||
}
|
||||
listener->onNoneReader(sender);
|
||||
}
|
||||
|
||||
bool MultiMediaSourceMuxer::setupRecord(MediaSource &sender, Recorder::type type, bool start, const string &custom_path) {
|
||||
return _muxer->setupRecord(sender,type,start,custom_path);
|
||||
}
|
||||
|
@ -131,6 +131,12 @@ public:
|
||||
*/
|
||||
int totalReaderCount(MediaSource &sender) override;
|
||||
|
||||
/**
|
||||
* 触发无人观看事件
|
||||
* @param sender 触发者
|
||||
*/
|
||||
void onNoneReader(MediaSource &sender) override;
|
||||
|
||||
/**
|
||||
* 设置录制状态
|
||||
* @param type 录制类型
|
||||
|
Loading…
Reference in New Issue
Block a user