合并主线
parent
16548e4f3c
commit
a8ba1630d2
|
@ -253,7 +253,7 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||
}
|
||||
}
|
||||
|
||||
public void channgeStreamIp(String localAddr) {
|
||||
public void changeStreamIp(String localAddr) {
|
||||
if (this.flv != null) {
|
||||
this.flv.setHost(localAddr);
|
||||
}
|
||||
|
@ -319,6 +319,72 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||
}
|
||||
}
|
||||
|
||||
public void changeStreamSign(String sign) {
|
||||
if (this.flv != null) {
|
||||
this.flv.setSign(sign);
|
||||
}
|
||||
if (this.ws_flv != null ){
|
||||
this.ws_flv.setSign(sign);
|
||||
}
|
||||
if (this.hls != null ) {
|
||||
this.hls.setSign(sign);
|
||||
}
|
||||
if (this.ws_hls != null ) {
|
||||
this.ws_hls.setSign(sign);
|
||||
}
|
||||
if (this.ts != null ) {
|
||||
this.ts.setSign(sign);
|
||||
}
|
||||
if (this.ws_ts != null ) {
|
||||
this.ws_ts.setSign(sign);
|
||||
}
|
||||
if (this.fmp4 != null ) {
|
||||
this.fmp4.setSign(sign);
|
||||
}
|
||||
if (this.ws_fmp4 != null ) {
|
||||
this.ws_fmp4.setSign(sign);
|
||||
}
|
||||
if (this.rtc != null ) {
|
||||
this.rtc.setSign(sign);
|
||||
}
|
||||
if (this.https_flv != null) {
|
||||
this.https_flv.setSign(sign);
|
||||
}
|
||||
if (this.wss_flv != null) {
|
||||
this.wss_flv.setSign(sign);
|
||||
}
|
||||
if (this.https_hls != null) {
|
||||
this.https_hls.setSign(sign);
|
||||
}
|
||||
if (this.wss_hls != null) {
|
||||
this.wss_hls.setSign(sign);
|
||||
}
|
||||
if (this.wss_ts != null) {
|
||||
this.wss_ts.setSign(sign);
|
||||
}
|
||||
if (this.https_fmp4 != null) {
|
||||
this.https_fmp4.setSign(sign);
|
||||
}
|
||||
if (this.wss_fmp4 != null) {
|
||||
this.wss_fmp4.setSign(sign);
|
||||
}
|
||||
if (this.rtcs != null) {
|
||||
this.rtcs.setSign(sign);
|
||||
}
|
||||
if (this.rtsp != null) {
|
||||
this.rtsp.setSign(sign);
|
||||
}
|
||||
if (this.rtsps != null) {
|
||||
this.rtsps.setSign(sign);
|
||||
}
|
||||
if (this.rtmp != null) {
|
||||
this.rtmp.setSign(sign);
|
||||
}
|
||||
if (this.rtmps != null) {
|
||||
this.rtmps.setSign(sign);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class TransactionInfo{
|
||||
public String callId;
|
||||
|
|
|
@ -83,7 +83,11 @@ public class StreamURL implements Serializable,Cloneable {
|
|||
@Override
|
||||
public String toString() {
|
||||
if (protocol != null && host != null && port != -1 ) {
|
||||
return String.format("%s://%s:%s/%s", protocol, host, port, file);
|
||||
String url = String.format("%s://%s:%s/%s", protocol, host, port, file);
|
||||
if (sign != null) {
|
||||
url += "?sign=" + sign;
|
||||
}
|
||||
return url;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -108,4 +108,12 @@ public class LoginUser implements UserDetails, CredentialsContainer {
|
|||
public void setAccessToken(String accessToken) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ public interface IUserService {
|
|||
PageInfo<User> getUsers(int page, int count);
|
||||
|
||||
int changePushKey(int id, String pushKey);
|
||||
|
||||
User getUserById(int id);
|
||||
}
|
||||
|
|
|
@ -91,4 +91,9 @@ public class UserServiceImpl implements IUserService {
|
|||
public int changePushKey(int id, String pushKey) {
|
||||
return userMapper.changePushKey(id,pushKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUserById(int id) {
|
||||
return userMapper.selectById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,12 @@
|
|||
package com.genersoft.iot.vmp.vmanager.channel;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.CommonGbChannel;
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Gb28181CodeType;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.service.ICommonGbChannelService;
|
||||
import com.genersoft.iot.vmp.service.bean.*;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -29,9 +20,7 @@ import org.springframework.web.context.request.async.DeferredResult;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Tag(name = "通用国标通道")
|
||||
|
||||
|
@ -207,7 +196,7 @@ public class CommonChannelController {
|
|||
} catch (MalformedURLException e) {
|
||||
host = request.getLocalAddr();
|
||||
}
|
||||
streamInfo.channgeStreamIp(host);
|
||||
streamInfo.changeStreamIp(host);
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
result.setResult(wvpResult);
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package com.genersoft.iot.vmp.vmanager.cloudRecord;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.DynamicTask;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||
import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.service.ICloudRecordService;
|
||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
|
@ -23,14 +19,12 @@ import org.apache.commons.lang3.ObjectUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
@ -311,7 +305,7 @@ public class CloudRecordController {
|
|||
} catch (MalformedURLException e) {
|
||||
host=request.getLocalAddr();
|
||||
}
|
||||
data.channgeStreamIp(host);
|
||||
data.changeStreamIp(host);
|
||||
}
|
||||
wvpResult.setData(new StreamContent(data));
|
||||
}
|
||||
|
|
|
@ -3,12 +3,10 @@ package com.genersoft.iot.vmp.vmanager.gb28181.play;
|
|||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.InviteInfo;
|
||||
import com.genersoft.iot.vmp.common.InviteSessionStatus;
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
||||
|
@ -140,7 +138,7 @@ public class PlayController {
|
|||
} catch (MalformedURLException e) {
|
||||
host=request.getLocalAddr();
|
||||
}
|
||||
streamInfo.channgeStreamIp(host);
|
||||
streamInfo.changeStreamIp(host);
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class PlaybackController {
|
|||
} catch (MalformedURLException e) {
|
||||
host=request.getLocalAddr();
|
||||
}
|
||||
streamInfo.channgeStreamIp(host);
|
||||
streamInfo.changeStreamIp(host);
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.genersoft.iot.vmp.vmanager.gb28181.record;
|
||||
|
||||
import com.genersoft.iot.vmp.common.InviteInfo;
|
||||
import com.genersoft.iot.vmp.common.InviteSessionType;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
|
@ -15,7 +13,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
|||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
|
@ -29,7 +26,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -159,7 +155,7 @@ public class GBRecordController {
|
|||
if (data != null) {
|
||||
StreamInfo streamInfo = (StreamInfo)data;
|
||||
if (userSetting.getUseSourceIpAsStreamIp()) {
|
||||
streamInfo.channgeStreamIp(request.getLocalAddr());
|
||||
streamInfo.changeStreamIp(request.getLocalAddr());
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
}
|
||||
|
|
|
@ -15,7 +15,9 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
|||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.service.IMediaService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
import com.genersoft.iot.vmp.service.IUserService;
|
||||
import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.User;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.*;
|
||||
import com.genersoft.iot.vmp.vmanager.streamPush.bean.StreamPushWithCommonChannelParam;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
@ -29,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
@ -61,6 +64,9 @@ public class StreamPushController {
|
|||
@Autowired
|
||||
private IMediaService mediaService;
|
||||
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
|
@ -305,7 +311,14 @@ public class StreamPushController {
|
|||
}
|
||||
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem, param.getApp(), param.getStream(), null, null);
|
||||
// 获取登录的用户,添加推流SIGN
|
||||
LoginUser userInfo = SecurityUtils.getUserInfo();
|
||||
|
||||
|
||||
if (userInfo == null || userInfo.getId() < 0 ) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
}
|
||||
User user = userService.getUserById(userInfo.getId());
|
||||
String checkSign = DigestUtils.md5DigestAsHex(user.getPushKey().getBytes());
|
||||
streamInfo.changeStreamSign(checkSign);
|
||||
return new StreamContent(streamInfo);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue