支持配置流传输模式
已知 zlm rtp udp 收流有问题, 故提供选项切换为 tcp 收流/下载
This commit is contained in:
parent
410de78a1c
commit
f36ed68607
@ -1,6 +1,7 @@
|
||||
package cn.skcks.docking.gb28181.wvp.config;
|
||||
|
||||
import cn.skcks.docking.gb28181.config.sip.SipConfig;
|
||||
import cn.skcks.docking.gb28181.core.sip.gb28181.sdp.StreamMode;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@ -29,6 +30,8 @@ public class ProxySipConfig {
|
||||
|
||||
private String transport = ListeningPoint.UDP;
|
||||
|
||||
private StreamMode streamMode = StreamMode.TCP_ACTIVE;
|
||||
|
||||
@Bean
|
||||
public SipConfig sipConfig(){
|
||||
SipConfig sipConfig = new SipConfig();
|
||||
|
@ -207,9 +207,10 @@ public class Gb28181DownloadService {
|
||||
long start = LocalDateTimeUtil.of(startTime.toInstant(), zoneId).atZone(zoneId).toEpochSecond();
|
||||
long end = LocalDateTimeUtil.of(endTime.toInstant(), zoneId).atZone(zoneId).toEpochSecond();
|
||||
String streamId = MediaSdpHelper.getStreamId(gbDeviceId, channel, String.valueOf(start), String.valueOf(end), IdUtil.getSnowflakeNextIdStr());
|
||||
int streamMode = proxySipConfig.getTransport().equalsIgnoreCase(ListeningPoint.UDP) ? 0 : 1;
|
||||
int isTcp = proxySipConfig.getStreamMode() == StreamMode.UDP ? 0 : 1;
|
||||
StreamMode streamMode = proxySipConfig.getStreamMode();
|
||||
String ip = zlmMediaConfig.getIp();
|
||||
int port = openRtpServer(streamId, streamMode);
|
||||
int port = openRtpServer(streamId, isTcp);
|
||||
if(port <= 0){
|
||||
log.error("zlm 暂无可用端口");
|
||||
result.complete(null);
|
||||
@ -220,10 +221,13 @@ public class Gb28181DownloadService {
|
||||
timeField.setStartTime(start);
|
||||
timeField.setStopTime(end);
|
||||
TimeDescription timeDescription = SdpFactory.getInstance().createTimeDescription(timeField);
|
||||
GB28181Description gb28181Description = MediaSdpHelper.build(MediaSdpHelper.Action.DOWNLOAD, gbDeviceId, channel, Connection.IP4, ip, port, ssrc, StreamMode.of(ListeningPoint.UDP), timeDescription);
|
||||
GB28181Description gb28181Description = MediaSdpHelper.build(MediaSdpHelper.Action.DOWNLOAD, gbDeviceId, channel, Connection.IP4, ip, port, ssrc, streamMode, timeDescription);
|
||||
gb28181Description.setSessionName(SdpFactory.getInstance().createSessionName(MediaSdpHelper.Action.DOWNLOAD.getAction()));
|
||||
gb28181Description.setTimeDescriptions(new Vector<>(){{add(timeDescription);}});
|
||||
MediaDescriptionImpl media = (MediaDescriptionImpl) gb28181Description.getMediaDescriptions(true).get(0);
|
||||
if(proxySipConfig.getStreamMode() != StreamMode.UDP){
|
||||
media.getMedia().setProtocol("RTP/AVP/TCP");
|
||||
}
|
||||
media.setAttribute("downloadspeed", String.valueOf(4));
|
||||
URIField uriField = new URIField();
|
||||
uriField.setURI(StringUtils.joinWith(":", channel, "0"));
|
||||
|
@ -35,7 +35,7 @@ spring:
|
||||
|
||||
media:
|
||||
ip: 10.10.10.200
|
||||
url: 'http://10.10.10.200:5080'
|
||||
url: 'http://10.10.10.200:5081'
|
||||
# url: 'http://10.10.10.200:12580/anything/'
|
||||
id: amrWMKmbKqoBjRQ9
|
||||
# secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
|
||||
@ -56,6 +56,7 @@ proxy:
|
||||
port: 5063
|
||||
ip:
|
||||
- 10.10.10.20
|
||||
stream-mode: tcp_active
|
||||
# - 192.168.1.241
|
||||
ffmpeg-support:
|
||||
ffmpeg: D:\Soft\Captura\ffmpeg\ffmpeg.exe
|
||||
|
@ -24,8 +24,8 @@ spring:
|
||||
username: root
|
||||
password: 123456a
|
||||
url: jdbc:mysql://192.168.1.241:3306/gb28181_docking_platform_dev?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||
# profiles:
|
||||
# active: local
|
||||
profiles:
|
||||
active: local
|
||||
cloud:
|
||||
openfeign:
|
||||
httpclient:
|
||||
@ -64,6 +64,7 @@ proxy:
|
||||
- 192.168.0.195
|
||||
# - 192.168.3.10
|
||||
# - 192.168.1.241
|
||||
stream-mode: tcp_active
|
||||
|
||||
ffmpeg-support:
|
||||
ffmpeg: /usr/bin/ffmpeg/ffmpeg
|
||||
|
Loading…
Reference in New Issue
Block a user