zlm 配置

This commit is contained in:
shikong 2024-03-13 21:58:14 +08:00
parent b61056e8b8
commit 9914186862
2 changed files with 5 additions and 5 deletions

View File

@ -170,18 +170,18 @@ public class DeviceProxyService {
log.info("结束 zlm rtp 推流, app {}, stream {}, ssrc {}", app, callId, ssrc);
zlmMediaService.stopSendRtp(stopSendRtp);
}, 3, TimeUnit.SECONDS);
}, 5, TimeUnit.SECONDS);
// 如果 3秒内 重新注册, 取消停止RTP推流
// 如果 5秒内 重新注册, 取消停止RTP推流
zlmStreamChangeHookService.getRegistHandler(app).put(callId,()->{
schedule.cancel(true);
zlmStreamRegistHookEvent(app, callId, ssrc);
});
// 如果 注销 3.5 秒内 没有再注册, 就彻底取消相关事件的订阅
// 如果 注销 5.5 秒内 没有再注册, 就彻底取消相关事件的订阅
scheduledExecutorService.schedule(()->{
zlmStreamChangeHookService.getRegistHandler(app).remove(callId);
},3500, TimeUnit.MILLISECONDS);
},5500, TimeUnit.MILLISECONDS);
});
});
}

View File

@ -29,7 +29,7 @@ public class ZlmInitService {
hook.setOnStreamChanged(zlmHookConfig.getHook() + "/on_stream_changed");
hook.setOnStreamNoneReader(zlmHookConfig.getHook() + "/on_stream_none_reader");
hook.setOnPublish(zlmHookConfig.getHook() + "/on_publish");
config.getRtmp().setHandshakeSecond(10);
config.getRtmp().setHandshakeSecond(15);
config.getRtmp().setKeepAliveSecond(10);
zlmMediaService.setServerConfig(config);
}