优化播放中zlm离线判断
This commit is contained in:
parent
3bf7ee18e0
commit
642407505b
@ -283,10 +283,10 @@ public class ZLMRTPServerFactory {
|
||||
*/
|
||||
public int totalReaderCount(MediaServerItem mediaServerItem, String app, String streamId) {
|
||||
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem, app, "rtmp", streamId);
|
||||
Integer code = mediaInfo.getInteger("code");
|
||||
if (mediaInfo == null) {
|
||||
return 0;
|
||||
}
|
||||
Integer code = mediaInfo.getInteger("code");
|
||||
if ( code < 0) {
|
||||
logger.warn("查询流({}/{})是否有其它观看者时得到: {}", app, streamId, mediaInfo.getString("msg"));
|
||||
return -1;
|
||||
|
@ -61,13 +61,12 @@ public class ZLMKeepliveTimeoutListener extends RedisKeyExpirationEventMessageLi
|
||||
// 发起http请求验证zlm是否确实无法连接,如果确实无法连接则发送离线事件,否则不作处理
|
||||
MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
||||
JSONObject mediaServerConfig = zlmresTfulUtils.getMediaServerConfig(mediaServerItem);
|
||||
if (mediaServerConfig == null || mediaServerConfig.getInteger("code") == -2) {
|
||||
publisher.zlmOfflineEventPublish(mediaServerId);
|
||||
}else {
|
||||
if (mediaServerConfig != null && mediaServerConfig.getInteger("code") == 0) {
|
||||
logger.info("[zlm心跳到期]:{}验证后zlm仍在线,恢复心跳信息", mediaServerId);
|
||||
// 添加zlm信息
|
||||
mediaServerService.updateMediaServerKeepalive(mediaServerId, mediaServerConfig);
|
||||
}else {
|
||||
publisher.zlmOfflineEventPublish(mediaServerId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user