From 7d7528cc275aec9962afd8ee38e6aaaa25b4392c Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 21 七月 2023 15:55:49 +0800
Subject: [PATCH] 更新readme
---
src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java | 54 +++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java
index 2fb6816..f412816 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java
@@ -85,6 +85,24 @@
}
@Override
+ public InviteInfo updateInviteInfoForStream(InviteInfo inviteInfo, String stream) {
+
+ InviteInfo inviteInfoInDb = getInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId(), inviteInfo.getChannelId(), inviteInfo.getStream());
+ if (inviteInfoInDb == null) {
+ return null;
+ }
+ removeInviteInfo(inviteInfoInDb);
+ String key = VideoManagerConstants.INVITE_PREFIX +
+ "_" + inviteInfo.getType() +
+ "_" + inviteInfo.getDeviceId() +
+ "_" + inviteInfo.getChannelId() +
+ "_" + stream;
+ inviteInfoInDb.setStream(stream);
+ redisTemplate.opsForValue().set(key, inviteInfoInDb);
+ return inviteInfoInDb;
+ }
+
+ @Override
public InviteInfo getInviteInfo(InviteSessionType type, String deviceId, String channelId, String stream) {
String key = VideoManagerConstants.INVITE_PREFIX +
"_" + (type != null ? type : "*") +
@@ -152,19 +170,6 @@
}
- @Override
- public void call(InviteSessionType type, String deviceId, String channelId, String stream, int code, String msg, Object data) {
- String key = buildKey(type, deviceId, channelId, stream);
- List<ErrorCallback<Object>> callbacks = inviteErrorCallbackMap.get(key);
- if (callbacks == null) {
- return;
- }
- for (ErrorCallback<Object> callback : callbacks) {
- callback.run(code, msg, data);
- }
- inviteErrorCallbackMap.remove(key);
- }
-
private String buildKey(InviteSessionType type, String deviceId, String channelId, String stream) {
String key = type + "_" + deviceId + "_" + channelId;
// 濡傛灉ssrc鏈猲ull閭d箞鍙互瀹炵幇涓�涓�氶亾鍙兘涓�娆℃搷浣滐紝ssrc涓嶄负null鍒欏彲浠ユ敮鎸佷竴涓�氶亾澶氭invite
@@ -198,4 +203,27 @@
}
return count;
}
+
+ @Override
+ public void call(InviteSessionType type, String deviceId, String channelId, String stream, int code, String msg, Object data) {
+ String key = buildSubStreamKey(type, deviceId, channelId, stream);
+ List<ErrorCallback<Object>> callbacks = inviteErrorCallbackMap.get(key);
+ if (callbacks == null) {
+ return;
+ }
+ for (ErrorCallback<Object> callback : callbacks) {
+ callback.run(code, msg, data);
+ }
+ inviteErrorCallbackMap.remove(key);
+ }
+
+
+ private String buildSubStreamKey(InviteSessionType type, String deviceId, String channelId, String stream) {
+ String key = type + "_" + "_" + deviceId + "_" + channelId;
+ // 濡傛灉ssrc涓簄ull閭d箞鍙互瀹炵幇涓�涓�氶亾鍙兘涓�娆℃搷浣滐紝ssrc涓嶄负null鍒欏彲浠ユ敮鎸佷竴涓�氶亾澶氭invite
+ if (stream != null) {
+ key += ("_" + stream);
+ }
+ return key;
+ }
}
--
Gitblit v1.8.0