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

pull/379/head^2
648540858 2022-03-07 01:23:23 +08:00
parent b2c953fc76
commit ca79100b6f
1 changed files with 10 additions and 0 deletions

View File

@ -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);