Commit 00e61d9a80b5b013a75d1ce567dc997694577a45
1 parent
48896474
增加对 需要扩展SDP的设备的单独设置
Showing
2 changed files
with
52 additions
and
24 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -68,6 +68,9 @@ public class SIPCommander implements ISIPCommander { | @@ -68,6 +68,9 @@ public class SIPCommander implements ISIPCommander { | ||
| 68 | @Value("${media.rtp.enable}") | 68 | @Value("${media.rtp.enable}") |
| 69 | private boolean rtpEnable; | 69 | private boolean rtpEnable; |
| 70 | 70 | ||
| 71 | + @Value("${media.seniorSdp}") | ||
| 72 | + private boolean seniorSdp; | ||
| 73 | + | ||
| 71 | @Autowired | 74 | @Autowired |
| 72 | private ZLMHttpHookSubscribe subscribe; | 75 | private ZLMHttpHookSubscribe subscribe; |
| 73 | 76 | ||
| @@ -396,30 +399,53 @@ public class SIPCommander implements ISIPCommander { | @@ -396,30 +399,53 @@ public class SIPCommander implements ISIPCommander { | ||
| 396 | mediaPort = mediaInfo.getRtpProxyPort(); | 399 | mediaPort = mediaInfo.getRtpProxyPort(); |
| 397 | } | 400 | } |
| 398 | String streamMode = device.getStreamMode().toUpperCase(); | 401 | String streamMode = device.getStreamMode().toUpperCase(); |
| 399 | - if("TCP-PASSIVE".equals(streamMode)) { | ||
| 400 | - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); | ||
| 401 | - }else if ("TCP-ACTIVE".equals(streamMode)) { | ||
| 402 | - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); | ||
| 403 | - }else if("UDP".equals(streamMode)) { | ||
| 404 | - content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n"); | ||
| 405 | - } | ||
| 406 | - content.append("a=recvonly\r\n"); | ||
| 407 | - content.append("a=fmtp:126 profile-level-id=42e01e\r\n"); | ||
| 408 | - content.append("a=rtpmap:126 H264/90000\r\n"); | ||
| 409 | - content.append("a=rtpmap:125 H264S/90000\r\n"); | ||
| 410 | - content.append("a=fmtp:125 profile-level-id=42e01e\r\n"); | ||
| 411 | - content.append("a=rtpmap:99 MP4V-ES/90000\r\n"); | ||
| 412 | - content.append("a=fmtp:99 profile-level-id=3\r\n"); | ||
| 413 | - content.append("a=rtpmap:98 H264/90000\r\n"); | ||
| 414 | - content.append("a=rtpmap:97 MPEG4/90000\r\n"); | ||
| 415 | - content.append("a=rtpmap:96 PS/90000\r\n"); | ||
| 416 | - if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 | ||
| 417 | - content.append("a=setup:passive\r\n"); | ||
| 418 | - content.append("a=connection:new\r\n"); | ||
| 419 | - }else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式 | ||
| 420 | - content.append("a=setup:active\r\n"); | ||
| 421 | - content.append("a=connection:new\r\n"); | 402 | + |
| 403 | + if (seniorSdp) { | ||
| 404 | + if("TCP-PASSIVE".equals(streamMode)) { | ||
| 405 | + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); | ||
| 406 | + }else if ("TCP-ACTIVE".equals(streamMode)) { | ||
| 407 | + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n"); | ||
| 408 | + }else if("UDP".equals(streamMode)) { | ||
| 409 | + content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n"); | ||
| 410 | + } | ||
| 411 | + content.append("a=recvonly\r\n"); | ||
| 412 | + content.append("a=fmtp:126 profile-level-id=42e01e\r\n"); | ||
| 413 | + content.append("a=rtpmap:126 H264/90000\r\n"); | ||
| 414 | + content.append("a=rtpmap:125 H264S/90000\r\n"); | ||
| 415 | + content.append("a=fmtp:125 profile-level-id=42e01e\r\n"); | ||
| 416 | + content.append("a=rtpmap:99 MP4V-ES/90000\r\n"); | ||
| 417 | + content.append("a=fmtp:99 profile-level-id=3\r\n"); | ||
| 418 | + content.append("a=rtpmap:98 H264/90000\r\n"); | ||
| 419 | + content.append("a=rtpmap:97 MPEG4/90000\r\n"); | ||
| 420 | + content.append("a=rtpmap:96 PS/90000\r\n"); | ||
| 421 | + if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 | ||
| 422 | + content.append("a=setup:passive\r\n"); | ||
| 423 | + content.append("a=connection:new\r\n"); | ||
| 424 | + }else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式 | ||
| 425 | + content.append("a=setup:active\r\n"); | ||
| 426 | + content.append("a=connection:new\r\n"); | ||
| 427 | + } | ||
| 428 | + }else { | ||
| 429 | + if("TCP-PASSIVE".equals(streamMode)) { | ||
| 430 | + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n"); | ||
| 431 | + }else if ("TCP-ACTIVE".equals(streamMode)) { | ||
| 432 | + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 98 97\r\n"); | ||
| 433 | + }else if("UDP".equals(streamMode)) { | ||
| 434 | + content.append("m=video "+ mediaPort +" RTP/AVP 96 98 97\r\n"); | ||
| 435 | + } | ||
| 436 | + content.append("a=recvonly\r\n"); | ||
| 437 | + content.append("a=rtpmap:96 PS/90000\r\n"); | ||
| 438 | + content.append("a=rtpmap:98 H264/90000\r\n"); | ||
| 439 | + content.append("a=rtpmap:97 MPEG4/90000\r\n"); | ||
| 440 | + if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式 | ||
| 441 | + content.append("a=setup:passive\r\n"); | ||
| 442 | + content.append("a=connection:new\r\n"); | ||
| 443 | + }else if ("TCP-ACTIVE".equals(streamMode)) { // tcp主动模式 | ||
| 444 | + content.append("a=setup:active\r\n"); | ||
| 445 | + content.append("a=connection:new\r\n"); | ||
| 446 | + } | ||
| 422 | } | 447 | } |
| 448 | + | ||
| 423 | content.append("y="+ssrc+"\r\n");//ssrc | 449 | content.append("y="+ssrc+"\r\n");//ssrc |
| 424 | 450 | ||
| 425 | Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "playback", null); | 451 | Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "playback", null); |
src/main/resources/application-dev.yml
| @@ -70,8 +70,10 @@ media: | @@ -70,8 +70,10 @@ media: | ||
| 70 | secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc | 70 | secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc |
| 71 | # [可选] zlm服务器的general.streamNoneReaderDelayMS | 71 | # [可选] zlm服务器的general.streamNoneReaderDelayMS |
| 72 | streamNoneReaderDelayMS: 600000 # 无人观看多久自动关闭流, -1表示永不自动关闭,即 关闭按需拉流 | 72 | streamNoneReaderDelayMS: 600000 # 无人观看多久自动关闭流, -1表示永不自动关闭,即 关闭按需拉流 |
| 73 | - # [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播 | 73 | + # [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true |
| 74 | autoApplyPlay: true | 74 | autoApplyPlay: true |
| 75 | + # [可选] 部分设备需要扩展SDP,需要打开此设置 | ||
| 76 | + seniorSdp: false | ||
| 75 | # 启用udp多端口模式, 详细解释参考: https://github.com/xia-chu/ZLMediaKit/wiki/GB28181%E6%8E%A8%E6%B5%81 下的高阶使用 | 77 | # 启用udp多端口模式, 详细解释参考: https://github.com/xia-chu/ZLMediaKit/wiki/GB28181%E6%8E%A8%E6%B5%81 下的高阶使用 |
| 76 | rtp: | 78 | rtp: |
| 77 | # [可选] 是否启用udp多端口模式, 开启后会在udpPortRange范围内选择端口用于媒体流传输 | 79 | # [可选] 是否启用udp多端口模式, 开启后会在udpPortRange范围内选择端口用于媒体流传输 |