瀏覽代碼

添加关闭收流发流的接口

648540858 2 年之前
父節點
當前提交
ed035b74d9
共有 1 個文件被更改,包括 30 次插入10 次删除
  1. 30 10
      src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java

+ 30 - 10
src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java

@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
 import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.conf.VersionInfo;
 import com.genersoft.iot.vmp.conf.exception.ControllerException;
+import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.service.*;
@@ -63,34 +64,53 @@ public class RtpController {
     private IRedisCatchStorage redisCatchStorage;
 
 
-    @GetMapping(value = "/openRtpServer")
+    @GetMapping(value = "/receive/open")
     @ResponseBody
     @Operation(summary = "开启收流和获取发流信息")
-    @Parameter(name = "isSend", description = "是否发送,false时同时只开启收流", required = true)
-    @Parameter(name = "callId", description = "整个过程的唯一标识", required = true)
-    @Parameter(name = "ssrc", description = "来源流的SSRC", required = false)
-    @Parameter(name = "hasAudio", description = "是否", required = false)
+    @Parameter(name = "isSend", description = "是否发送,false时只开启收流, true同时返回推流信息", required = true)
+    @Parameter(name = "callId", description = "整个过程的唯一标识,为了与后续接口关联", required = true)
+    @Parameter(name = "ssrc", description = "来源流的SSRC,不传则不校验来源ssrc", required = false)
     @Parameter(name = "stream", description = "形成的流的ID", required = true)
     @Parameter(name = "tcpMode", description = "收流模式, 0为UDP, 1为TCP被动", required = true)
-    public void openRtpServer(Boolean isSend, String ssrc, String callId, Boolean hasAudio, String stream, Integer tcpMode) {
+    @Parameter(name = "callBack", description = "回调地址,如果收流超时会通道回调通知,回调为get请求,参数为callId", required = true)
+    public SendRtpItem openRtpServer(Boolean isSend, String ssrc, String callId, String stream, Integer tcpMode, String callBack) {
         MediaServerItem mediaServerItem = mediaServerService.getMediaServerForMinimumLoad(null);
         if (mediaServerItem == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(),"没有可用的MediaServer");
         }
+        return null;
     }
 
-    @GetMapping(value = "/sendRTP")
+    @GetMapping(value = "/receive/close")
     @ResponseBody
-    @Operation(summary = "发送流")
+    @Operation(summary = "关闭收流")
+    @Parameter(name = "stream", description = "流的ID", required = true)
+    public void closeRtpServer(String stream) {
+
+    }
 
+    @GetMapping(value = "/send/start")
+    @ResponseBody
+    @Operation(summary = "发送流")
     @Parameter(name = "ssrc", description = "发送流的SSRC", required = true)
     @Parameter(name = "ip", description = "目标IP", required = true)
     @Parameter(name = "port", description = "目标端口", required = true)
     @Parameter(name = "app", description = "待发送应用名", required = true)
     @Parameter(name = "stream", description = "待发送流Id", required = true)
-    @Parameter(name = "callId", description = "整个过程的唯一标识", required = true)
+    @Parameter(name = "callId", description = "整个过程的唯一标识,不传则使用随机端口发流", required = true)
     @Parameter(name = "onlyAudio", description = "是否只有音频", required = true)
-    public void sendRTP(String ssrc, String ip, Integer port, String app, String stream, String callId, Boolean onlyAudio) {
+    @Parameter(name = "streamType", description = "流类型,1为es流,2为ps流, 默认es流", required = false)
+    public void sendRTP(String ssrc, String ip, Integer port, String app, String stream, String callId, Boolean onlyAudio, Integer streamType) {
+
+    }
+
+
+
+    @GetMapping(value = "/send/stop")
+    @ResponseBody
+    @Operation(summary = "关闭发送流")
+    @Parameter(name = "callId", description = "整个过程的唯一标识,不传则使用随机端口发流", required = true)
+    public void closeSendRTP(String callId) {
 
     }