Commit ca79100b6fae7b1963d1653227d67345893a0672
1 parent
b2c953fc
优化失败的录像点播的ssrc释放逻辑
Showing
1 changed file
with
10 additions
and
0 deletions
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -348,6 +348,7 @@ public class PlayServiceImpl implements IPlayService { |
| 348 | 348 | msg.setId(uuid); |
| 349 | 349 | msg.setKey(key); |
| 350 | 350 | PlayBackResult<RequestMessage> playBackResult = new PlayBackResult<>(); |
| 351 | + | |
| 351 | 352 | Timer timer = new Timer(); |
| 352 | 353 | timer.schedule(new TimerTask() { |
| 353 | 354 | @Override |
| ... | ... | @@ -356,7 +357,16 @@ public class PlayServiceImpl implements IPlayService { |
| 356 | 357 | playBackResult.setCode(-1); |
| 357 | 358 | playBackResult.setData(msg); |
| 358 | 359 | callback.call(playBackResult); |
| 360 | + SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); | |
| 359 | 361 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 |
| 362 | + if (dialog != null) { | |
| 363 | + // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 | |
| 364 | + cmder.streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream()); | |
| 365 | + }else { | |
| 366 | + mediaServerService.releaseSsrc(newMediaServerItem.getId(), ssrcInfo.getSsrc()); | |
| 367 | + mediaServerService.closeRTPServer(deviceId, channelId, ssrcInfo.getStream()); | |
| 368 | + streamSession.remove(deviceId, channelId, ssrcInfo.getStream()); | |
| 369 | + } | |
| 360 | 370 | cmder.streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream()); |
| 361 | 371 | // 回复之前所有的点播请求 |
| 362 | 372 | callback.call(playBackResult); | ... | ... |