Browse Source

优化失败的录像点播的ssrc释放逻辑

pull/387/head
648540858 3 years ago
parent
commit
ca79100b6f
  1. 10
      src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java

10
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java

@ -348,6 +348,7 @@ public class PlayServiceImpl implements IPlayService {
msg.setId(uuid);
msg.setKey(key);
PlayBackResult<RequestMessage> playBackResult = new PlayBackResult<>();
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
@ -356,7 +357,16 @@ public class PlayServiceImpl implements IPlayService {
playBackResult.setCode(-1);
playBackResult.setData(msg);
callback.call(playBackResult);
SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream());
// 点播超时回复BYE 同时释放ssrc以及此次点播的资源
if (dialog != null) {
// 点播超时回复BYE 同时释放ssrc以及此次点播的资源
cmder.streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream());
}else {
mediaServerService.releaseSsrc(newMediaServerItem.getId(), ssrcInfo.getSsrc());
mediaServerService.closeRTPServer(deviceId, channelId, ssrcInfo.getStream());
streamSession.remove(deviceId, channelId, ssrcInfo.getStream());
}
cmder.streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream());
// 回复之前所有的点播请求
callback.call(playBackResult);

Loading…
Cancel
Save