From 37b1978da586a73f000869335ac488d0bf72759d Mon Sep 17 00:00:00 2001
From: Lawrence <1934378145@qq.com>
Date: 星期日, 10 一月 2021 23:08:47 +0800
Subject: [PATCH] 删除多余注释
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 95 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
index 26d0f23..4a76e9a 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -77,6 +77,9 @@
@Value("${media.seniorSdp}")
private boolean seniorSdp;
+ @Value("${media.autoApplyPlay}")
+ private boolean autoApplyPlay;
+
@Autowired
private ZLMHttpHookSubscribe subscribe;
@@ -287,8 +290,12 @@
@Override
public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
try {
-
- String ssrc = streamSession.createPlaySsrc();
+ String ssrc = "";
+ if (rtpEnable) {
+ ssrc = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
+ }else {
+ ssrc = streamSession.createPlaySsrc();
+ }
String streamId = null;
if (rtpEnable) {
streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
@@ -323,30 +330,61 @@
content.append("s=Play\r\n");
content.append("c=IN IP4 "+mediaInfo.getWanIp()+"\r\n");
content.append("t=0 0\r\n");
- if("TCP-PASSIVE".equals(streamMode)) {
- content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
- }else if ("TCP-ACTIVE".equals(streamMode)) {
- content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
- }else if("UDP".equals(streamMode)) {
- content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
+
+ if (seniorSdp) {
+ if("TCP-PASSIVE".equals(streamMode)) {
+ content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
+ }else if ("TCP-ACTIVE".equals(streamMode)) {
+ content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
+ }else if("UDP".equals(streamMode)) {
+ content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
+ }
+ content.append("a=recvonly\r\n");
+ content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
+ content.append("a=rtpmap:126 H264/90000\r\n");
+ content.append("a=rtpmap:125 H264S/90000\r\n");
+ content.append("a=fmtp:125 profile-level-id=42e01e\r\n");
+ content.append("a=rtpmap:99 MP4V-ES/90000\r\n");
+ content.append("a=fmtp:99 profile-level-id=3\r\n");
+ content.append("a=rtpmap:98 H264/90000\r\n");
+ content.append("a=rtpmap:97 MPEG4/90000\r\n");
+ content.append("a=rtpmap:96 PS/90000\r\n");
+ if("TCP-PASSIVE".equals(streamMode)){ // tcp琚姩妯″紡
+ content.append("a=setup:passive\r\n");
+ content.append("a=connection:new\r\n");
+ }else if ("TCP-ACTIVE".equals(streamMode)) { // tcp涓诲姩妯″紡
+ content.append("a=setup:active\r\n");
+ content.append("a=connection:new\r\n");
+ }
+ }else {
+ if("TCP-PASSIVE".equals(streamMode)) {
+ content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n");
+ }else if ("TCP-ACTIVE".equals(streamMode)) {
+ content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n");
+ }else if("UDP".equals(streamMode)) {
+ content.append("m=video "+ mediaPort +" RTP/AVP 96 98 97\r\n");
+ }
+ content.append("a=recvonly\r\n");
+ content.append("a=rtpmap:96 PS/90000\r\n");
+ content.append("a=rtpmap:98 H264/90000\r\n");
+ content.append("a=rtpmap:97 MPEG4/90000\r\n");
+ if("TCP-PASSIVE".equals(streamMode)) { // tcp琚姩妯″紡
+ content.append("a=setup:passive\r\n");
+ content.append("a=recvonly\r\n");
+ content.append("a=rtpmap:96 PS/90000\r\n");
+ content.append("a=rtpmap:98 H264/90000\r\n");
+ content.append("a=rtpmap:97 MPEG4/90000\r\n");
+ if ("TCP-PASSIVE".equals(streamMode)) { // tcp琚姩妯″紡
+ content.append("a=setup:passive\r\n");
+ content.append("a=connection:new\r\n");
+ } else if ("TCP-ACTIVE".equals(streamMode)) { // tcp涓诲姩妯″紡
+ } else if ("TCP-ACTIVE".equals(streamMode)) { // tcp涓诲姩妯″紡
+ content.append("a=setup:active\r\n");
+ content.append("a=connection:new\r\n");
+ }
+ }
}
- content.append("a=recvonly\r\n");
- content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
- content.append("a=rtpmap:126 H264/90000\r\n");
- content.append("a=rtpmap:125 H264S/90000\r\n");
- content.append("a=fmtp:125 profile-level-id=42e01e\r\n");
- content.append("a=rtpmap:99 MP4V-ES/90000\r\n");
- content.append("a=fmtp:99 profile-level-id=3\r\n");
- content.append("a=rtpmap:98 H264/90000\r\n");
- content.append("a=rtpmap:97 MPEG4/90000\r\n");
- content.append("a=rtpmap:96 PS/90000\r\n");
- if("TCP-PASSIVE".equals(streamMode)){ // tcp琚姩妯″紡
- content.append("a=setup:passive\r\n");
- content.append("a=connection:new\r\n");
- }else if ("TCP-ACTIVE".equals(streamMode)) { // tcp涓诲姩妯″紡
- content.append("a=setup:active\r\n");
- content.append("a=connection:new\r\n");
- }
+
content.append("y="+ssrc+"\r\n");//ssrc
// String fromTag = UUID.randomUUID().toString();
@@ -377,7 +415,12 @@
, SipSubscribe.Event errorEvent) {
try {
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
- String ssrc = streamSession.createPlayBackSsrc();
+ String ssrc = null;
+ if (rtpEnable) {
+ ssrc = String.format("gb_playback_%s_%s", device.getDeviceId(), channelId);
+ }else {
+ ssrc = streamSession.createPlayBackSsrc();
+ }
String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
// 娣诲姞璁㈤槄
JSONObject subscribeKey = new JSONObject();
--
Gitblit v1.8.0