From 07a8ef9e256c70a3a5b15782add81dcad1e2ffc2 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期五, 14 六月 2024 00:03:57 +0800
Subject: [PATCH] SIP只有一个监听时,直接返回

---
 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java |  148 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 140 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java
index c1fe2c1..55f09df 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java
@@ -1,5 +1,9 @@
 package com.genersoft.iot.vmp.gb28181.bean;
 
+import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg;
+
+import com.genersoft.iot.vmp.common.VideoManagerConstants;
+
 public class SendRtpItem {
 
     /**
@@ -21,6 +25,11 @@
      * 骞冲彴id
      */
     private String platformId;
+
+    /**
+     * 骞冲彴鍚嶇О
+     */
+    private String platformName;
 
      /**
      * 瀵瑰簲璁惧id
@@ -49,7 +58,7 @@
     /**
      * 璁惧鎺ㄦ祦鐨剆treamId
      */
-    private String streamId;
+    private String stream;
 
     /**
      * 鏄惁涓簍cp
@@ -60,6 +69,11 @@
      * 鏄惁涓簍cp涓诲姩妯″紡
      */
     private boolean tcpActive;
+
+    /**
+     * 鑷繁鎺ㄦ祦浣跨敤鐨処P
+     */
+    private String localIp;
 
     /**
      * 鑷繁鎺ㄦ祦浣跨敤鐨勭鍙�
@@ -79,7 +93,7 @@
     /**
      *  invite 鐨� callId
      */
-    private String CallId;
+    private String callId;
 
     /**
      *  invite 鐨� fromTag
@@ -116,6 +130,49 @@
      * 鎾斁绫诲瀷
      */
     private InviteStreamType playType;
+
+    /**
+     * 鍙戞祦鐨勫悓鏃舵敹娴�
+     */
+    private String receiveStream;
+
+    /**
+     * 涓婄骇鐨勭偣鎾被鍨�
+     */
+    private String sessionName;
+
+    public static SendRtpItem getInstance(RequestPushStreamMsg requestPushStreamMsg) {
+        SendRtpItem sendRtpItem = new SendRtpItem();
+        sendRtpItem.setMediaServerId(requestPushStreamMsg.getMediaServerId());
+        sendRtpItem.setApp(requestPushStreamMsg.getApp());
+        sendRtpItem.setStream(requestPushStreamMsg.getStream());
+        sendRtpItem.setIp(requestPushStreamMsg.getIp());
+        sendRtpItem.setPort(requestPushStreamMsg.getPort());
+        sendRtpItem.setSsrc(requestPushStreamMsg.getSsrc());
+        sendRtpItem.setTcp(requestPushStreamMsg.isTcp());
+        sendRtpItem.setLocalPort(requestPushStreamMsg.getSrcPort());
+        sendRtpItem.setPt(requestPushStreamMsg.getPt());
+        sendRtpItem.setUsePs(requestPushStreamMsg.isPs());
+        sendRtpItem.setOnlyAudio(requestPushStreamMsg.isOnlyAudio());
+        return sendRtpItem;
+
+    }
+
+    public static SendRtpItem getInstance(String app, String stream, String ssrc, String dstIp, Integer dstPort, boolean tcp, int sendLocalPort, Integer pt) {
+        SendRtpItem sendRtpItem = new SendRtpItem();
+        sendRtpItem.setApp(app);
+        sendRtpItem.setStream(stream);
+        sendRtpItem.setSsrc(ssrc);
+        sendRtpItem.setTcp(tcp);
+        sendRtpItem.setLocalPort(sendLocalPort);
+        sendRtpItem.setIp(dstIp);
+        sendRtpItem.setPort(dstPort);
+        if (pt != null) {
+            sendRtpItem.setPt(pt);
+        }
+
+        return sendRtpItem;
+    }
 
     public String getIp() {
         return ip;
@@ -181,12 +238,12 @@
         this.app = app;
     }
 
-    public String getStreamId() {
-        return streamId;
+    public String getStream() {
+        return stream;
     }
 
-    public void setStreamId(String streamId) {
-        this.streamId = streamId;
+    public void setStream(String stream) {
+        this.stream = stream;
     }
 
     public boolean isTcp() {
@@ -222,11 +279,11 @@
     }
 
     public String getCallId() {
-        return CallId;
+        return callId;
     }
 
     public void setCallId(String callId) {
-        CallId = callId;
+        this.callId = callId;
     }
 
     public InviteStreamType getPlayType() {
@@ -292,4 +349,79 @@
     public void setRtcp(boolean rtcp) {
         this.rtcp = rtcp;
     }
+
+    public String getReceiveStream() {
+        return receiveStream;
+    }
+
+    public void setReceiveStream(String receiveStream) {
+        this.receiveStream = receiveStream;
+    }
+
+    public String getPlatformName() {
+        return platformName;
+    }
+
+    public void setPlatformName(String platformName) {
+        this.platformName = platformName;
+    }
+
+    public String getLocalIp() {
+        return localIp;
+    }
+
+    public void setLocalIp(String localIp) {
+        this.localIp = localIp;
+    }
+
+    public String getSessionName() {
+        return sessionName;
+    }
+
+    public void setSessionName(String sessionName) {
+        this.sessionName = sessionName;
+    }
+
+    @Override
+    public String toString() {
+        return "SendRtpItem{" +
+                "ip='" + ip + '\'' +
+                ", port=" + port +
+                ", ssrc='" + ssrc + '\'' +
+                ", platformId='" + platformId + '\'' +
+                ", platformName='" + platformName + '\'' +
+                ", deviceId='" + deviceId + '\'' +
+                ", app='" + app + '\'' +
+                ", channelId='" + channelId + '\'' +
+                ", status=" + status +
+                ", stream='" + stream + '\'' +
+                ", tcp=" + tcp +
+                ", tcpActive=" + tcpActive +
+                ", localIp='" + localIp + '\'' +
+                ", localPort=" + localPort +
+                ", mediaServerId='" + mediaServerId + '\'' +
+                ", serverId='" + serverId + '\'' +
+                ", CallId='" + callId + '\'' +
+                ", fromTag='" + fromTag + '\'' +
+                ", toTag='" + toTag + '\'' +
+                ", pt=" + pt +
+                ", usePs=" + usePs +
+                ", onlyAudio=" + onlyAudio +
+                ", rtcp=" + rtcp +
+                ", playType=" + playType +
+                ", receiveStream='" + receiveStream + '\'' +
+                ", sessionName='" + sessionName + '\'' +
+                '}';
+    }
+
+    public String getRedisKey() {
+        String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX +
+                serverId + "_"
+                + mediaServerId + "_"
+                + platformId + "_"
+                + channelId + "_"
+                + stream + "_"
+                + callId;
+        return key;
+    }
 }

--
Gitblit v1.8.0