From bde0e13682ed75d2e8c0cb8a1fd6a96bb92f1dd8 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 14 三月 2022 18:34:25 +0800 Subject: [PATCH] #394 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java index baf0b3c..c884495 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; +import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; @@ -46,6 +47,9 @@ @Autowired private IStreamPushService streamPushService; + + @Autowired + private IStreamProxyService streamProxyService; @Autowired private StreamPushMapper streamPushMapper; @@ -101,7 +105,7 @@ updateMedia(mediaServerItem, app, streamId); } - public void addMedia(MediaItem mediaItem) { + public StreamPushItem addPush(MediaItem mediaItem) { // 鏌ユ壘姝ょ洿鎾祦鏄惁瀛樺湪redis棰勮gbId StreamPushItem transform = streamPushService.transform(mediaItem); // 浠巗treamId鍙栧嚭鏌ヨ鍏抽敭鍊� @@ -118,7 +122,6 @@ transform.setName(thirdPartyGB.getName()); } } - storager.updateMedia(transform); if (!StringUtils.isEmpty(transform.getGbId())) { // 濡傛灉杩欎釜鍥芥爣ID宸茬粡缁欎簡鍏朵粬鎺ㄦ祦涓旀祦宸茬绾匡紝鍒欑Щ闄ゅ叾浠栨帹娴� List<GbStream> gbStreams = gbStreamMapper.selectByGBId(transform.getGbId()); @@ -126,19 +129,22 @@ for (GbStream gbStream : gbStreams) { // 鍑虹幇浣跨敤鐩稿悓鍥芥爣Id鐨勮棰戞祦鏃讹紝浣跨敤鏂版祦鏇挎崲鏃ф祦锛� gbStreamMapper.del(gbStream.getApp(), gbStream.getStream()); - platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream()); if (!gbStream.isStatus()) { streamPushMapper.del(gbStream.getApp(), gbStream.getStream()); } } } - if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) { + StreamProxyItem streamProxyItem = gbStreamMapper.selectOne(transform.getApp(), transform.getStream()); + if (streamProxyItem != null) { + transform.setGbStreamId(streamProxyItem.getGbStreamId()); gbStreamMapper.update(transform); }else { + transform.setCreateStamp(System.currentTimeMillis()); gbStreamMapper.add(transform); } - } + storager.updateMedia(transform); + return transform; } @@ -179,6 +185,8 @@ return result; } + + // public void clearAllSessions() { // logger.info("娓呯┖鎵�鏈夊浗鏍囩浉鍏崇殑session"); // JSONObject allSessionJSON = zlmresTfulUtils.getAllSession(); -- Gitblit v1.8.0