Commit 03f35986818c86436a703493b7ac1147ce0e62fd

Authored by 648540858
1 parent 20a47729

修复stream-on-demand配置失效的BUG

src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -451,11 +451,6 @@ public class ZLMHttpHookListener { @@ -451,11 +451,6 @@ public class ZLMHttpHookListener {
451 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, param.getStream()); 451 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, param.getStream());
452 // 点播 452 // 点播
453 if (inviteInfo != null) { 453 if (inviteInfo != null) {
454 - // 录像下载  
455 - if (inviteInfo.getType() == InviteSessionType.DOWNLOAD) {  
456 - ret.put("close", false);  
457 - return ret;  
458 - }  
459 // 收到无人观看说明流也没有在往上级推送 454 // 收到无人观看说明流也没有在往上级推送
460 if (redisCatchStorage.isChannelSendingRTP(inviteInfo.getChannelId())) { 455 if (redisCatchStorage.isChannelSendingRTP(inviteInfo.getChannelId())) {
461 List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId( 456 List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId(
@@ -473,22 +468,31 @@ public class ZLMHttpHookListener { @@ -473,22 +468,31 @@ public class ZLMHttpHookListener {
473 } 468 }
474 } 469 }
475 } 470 }
476 - Device device = deviceService.getDevice(inviteInfo.getDeviceId());  
477 - if (device != null) {  
478 - try {  
479 - if (inviteStreamService.getInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId(), inviteInfo.getChannelId(), inviteInfo.getStream()) != null) {  
480 - cmder.streamByeCmd(device, inviteInfo.getChannelId(),  
481 - inviteInfo.getStream(), null); 471 +
  472 + if (userSetting.getStreamOnDemand()) {
  473 + // 录像下载
  474 + if (inviteInfo.getType() == InviteSessionType.DOWNLOAD) {
  475 + ret.put("close", false);
  476 + return ret;
  477 + }
  478 +
  479 + Device device = deviceService.getDevice(inviteInfo.getDeviceId());
  480 + if (device != null) {
  481 + try {
  482 + if (inviteStreamService.getInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId(), inviteInfo.getChannelId(), inviteInfo.getStream()) != null) {
  483 + cmder.streamByeCmd(device, inviteInfo.getChannelId(),
  484 + inviteInfo.getStream(), null);
  485 + }
  486 + } catch (InvalidArgumentException | ParseException | SipException |
  487 + SsrcTransactionNotFoundException e) {
  488 + logger.error("[无人观看]点播, 发送BYE失败 {}", e.getMessage());
482 } 489 }
483 - } catch (InvalidArgumentException | ParseException | SipException |  
484 - SsrcTransactionNotFoundException e) {  
485 - logger.error("[无人观看]点播, 发送BYE失败 {}", e.getMessage());  
486 } 490 }
487 - }  
488 491
489 - inviteStreamService.removeInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId(),  
490 - inviteInfo.getChannelId(), inviteInfo.getStream());  
491 - storager.stopPlay(inviteInfo.getDeviceId(), inviteInfo.getChannelId()); 492 + inviteStreamService.removeInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId(),
  493 + inviteInfo.getChannelId(), inviteInfo.getStream());
  494 + storager.stopPlay(inviteInfo.getDeviceId(), inviteInfo.getChannelId());
  495 + }
492 return ret; 496 return ret;
493 } 497 }
494 } else { 498 } else {