Merge branch 'wvp-28181-2.0' into feature/record
# Conflicts: # src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java # src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
This commit is contained in:
@@ -259,19 +259,22 @@ public class ZLMHttpHookListener {
|
||||
} else {
|
||||
result.setEnable_mp4(userSetting.isRecordPushLive());
|
||||
}
|
||||
// 替换流地址
|
||||
if ("rtp".equals(param.getApp()) && !mediaInfo.isRtpEnable()) {
|
||||
if (!mediaInfo.isRtpEnable()) {
|
||||
String ssrc = String.format("%010d", Long.parseLong(param.getStream(), 16));;
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoBySSRC(ssrc);
|
||||
// 国标流
|
||||
if ("rtp".equals(param.getApp()) ) {
|
||||
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, param.getStream());
|
||||
|
||||
// 单端口模式下修改流 ID
|
||||
if (!mediaInfo.isRtpEnable() && inviteInfo == null) {
|
||||
String ssrc = String.format("%010d", Long.parseLong(param.getStream(), 16));
|
||||
inviteInfo = inviteStreamService.getInviteInfoBySSRC(ssrc);
|
||||
if (inviteInfo != null) {
|
||||
result.setStream_replace(inviteInfo.getStream());
|
||||
logger.info("[ZLM HOOK]推流鉴权 stream: {} 替换为 {}", param.getStream(), inviteInfo.getStream());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 设置音频信息及录制信息
|
||||
List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream());
|
||||
if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
|
||||
|
||||
@@ -292,10 +295,10 @@ public class ZLMHttpHookListener {
|
||||
// 如果是录像下载就设置视频间隔十秒
|
||||
if (ssrcTransactionForAll.get(0).getType() == InviteSessionType.DOWNLOAD) {
|
||||
// 获取录像的总时长,然后设置为这个视频的时长
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, deviceId, channelId, param.getStream());
|
||||
if (inviteInfo.getStreamInfo() != null ) {
|
||||
String startTime = inviteInfo.getStreamInfo().getStartTime();
|
||||
String endTime = inviteInfo.getStreamInfo().getEndTime();
|
||||
InviteInfo inviteInfoForDownload = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, deviceId, channelId, param.getStream());
|
||||
if (inviteInfoForDownload != null && inviteInfoForDownload.getStreamInfo() != null ) {
|
||||
String startTime = inviteInfoForDownload.getStreamInfo().getStartTime();
|
||||
String endTime = inviteInfoForDownload.getStreamInfo().getEndTime();
|
||||
long difference = DateUtil.getDifference(startTime, endTime)/1000;
|
||||
result.setMp4_max_second((int)difference);
|
||||
result.setEnable_mp4(true);
|
||||
@@ -529,11 +532,15 @@ public class ZLMHttpHookListener {
|
||||
if (info != null) {
|
||||
cmder.streamByeCmd(device, inviteInfo.getChannelId(),
|
||||
inviteInfo.getStream(), null);
|
||||
}else {
|
||||
logger.info("[无人观看] 未找到设备的点播信息: {}, 流:{}", inviteInfo.getDeviceId(), param.getStream());
|
||||
}
|
||||
} catch (InvalidArgumentException | ParseException | SipException |
|
||||
SsrcTransactionNotFoundException e) {
|
||||
logger.error("[无人观看]点播, 发送BYE失败 {}", e.getMessage());
|
||||
}
|
||||
}else {
|
||||
logger.info("[无人观看] 未找到设备: {},流:{}", inviteInfo.getDeviceId(), param.getStream());
|
||||
}
|
||||
|
||||
inviteStreamService.removeInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId(),
|
||||
@@ -598,7 +605,7 @@ public class ZLMHttpHookListener {
|
||||
String deviceId = s[0];
|
||||
String channelId = s[1];
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
if (device == null) {
|
||||
if (device == null || !device.isOnLine()) {
|
||||
defaultResult.setResult(new HookResult(ErrorCode.ERROR404.getCode(), ErrorCode.ERROR404.getMsg()));
|
||||
return defaultResult;
|
||||
}
|
||||
|
||||
@@ -120,17 +120,17 @@ public class OnStreamChangedHookParam extends HookParam{
|
||||
/**
|
||||
* H264 = 0, H265 = 1, AAC = 2, G711A = 3, G711U = 4
|
||||
*/
|
||||
private int codecId;
|
||||
private int codec_id;
|
||||
|
||||
/**
|
||||
* 编码类型名称 CodecAAC CodecH264
|
||||
*/
|
||||
private String codecIdName;
|
||||
private String codec_id_name;
|
||||
|
||||
/**
|
||||
* Video = 0, Audio = 1
|
||||
*/
|
||||
private int codecType;
|
||||
private int codec_type;
|
||||
|
||||
/**
|
||||
* 轨道是否准备就绪
|
||||
@@ -140,17 +140,17 @@ public class OnStreamChangedHookParam extends HookParam{
|
||||
/**
|
||||
* 音频采样位数
|
||||
*/
|
||||
private int sampleBit;
|
||||
private int sample_bit;
|
||||
|
||||
/**
|
||||
* 音频采样率
|
||||
*/
|
||||
private int sampleRate;
|
||||
private int sample_rate;
|
||||
|
||||
/**
|
||||
* 视频fps
|
||||
*/
|
||||
private int fps;
|
||||
private float fps;
|
||||
|
||||
/**
|
||||
* 视频高
|
||||
@@ -162,6 +162,31 @@ public class OnStreamChangedHookParam extends HookParam{
|
||||
*/
|
||||
private int width;
|
||||
|
||||
/**
|
||||
* 帧数
|
||||
*/
|
||||
private int frames;
|
||||
|
||||
/**
|
||||
* 关键帧数
|
||||
*/
|
||||
private int key_frames;
|
||||
|
||||
/**
|
||||
* GOP大小
|
||||
*/
|
||||
private int gop_size;
|
||||
|
||||
/**
|
||||
* GOP间隔时长(ms)
|
||||
*/
|
||||
private int gop_interval_ms;
|
||||
|
||||
/**
|
||||
* 丢帧率
|
||||
*/
|
||||
private float loss;
|
||||
|
||||
public int getChannels() {
|
||||
return channels;
|
||||
}
|
||||
@@ -170,28 +195,28 @@ public class OnStreamChangedHookParam extends HookParam{
|
||||
this.channels = channels;
|
||||
}
|
||||
|
||||
public int getCodecId() {
|
||||
return codecId;
|
||||
public int getCodec_id() {
|
||||
return codec_id;
|
||||
}
|
||||
|
||||
public void setCodecId(int codecId) {
|
||||
this.codecId = codecId;
|
||||
public void setCodec_id(int codec_id) {
|
||||
this.codec_id = codec_id;
|
||||
}
|
||||
|
||||
public String getCodecIdName() {
|
||||
return codecIdName;
|
||||
public String getCodec_id_name() {
|
||||
return codec_id_name;
|
||||
}
|
||||
|
||||
public void setCodecIdName(String codecIdName) {
|
||||
this.codecIdName = codecIdName;
|
||||
public void setCodec_id_name(String codec_id_name) {
|
||||
this.codec_id_name = codec_id_name;
|
||||
}
|
||||
|
||||
public int getCodecType() {
|
||||
return codecType;
|
||||
public int getCodec_type() {
|
||||
return codec_type;
|
||||
}
|
||||
|
||||
public void setCodecType(int codecType) {
|
||||
this.codecType = codecType;
|
||||
public void setCodec_type(int codec_type) {
|
||||
this.codec_type = codec_type;
|
||||
}
|
||||
|
||||
public boolean isReady() {
|
||||
@@ -202,27 +227,27 @@ public class OnStreamChangedHookParam extends HookParam{
|
||||
this.ready = ready;
|
||||
}
|
||||
|
||||
public int getSampleBit() {
|
||||
return sampleBit;
|
||||
public int getSample_bit() {
|
||||
return sample_bit;
|
||||
}
|
||||
|
||||
public void setSampleBit(int sampleBit) {
|
||||
this.sampleBit = sampleBit;
|
||||
public void setSample_bit(int sample_bit) {
|
||||
this.sample_bit = sample_bit;
|
||||
}
|
||||
|
||||
public int getSampleRate() {
|
||||
return sampleRate;
|
||||
public int getSample_rate() {
|
||||
return sample_rate;
|
||||
}
|
||||
|
||||
public void setSampleRate(int sampleRate) {
|
||||
this.sampleRate = sampleRate;
|
||||
public void setSample_rate(int sample_rate) {
|
||||
this.sample_rate = sample_rate;
|
||||
}
|
||||
|
||||
public int getFps() {
|
||||
public float getFps() {
|
||||
return fps;
|
||||
}
|
||||
|
||||
public void setFps(int fps) {
|
||||
public void setFps(float fps) {
|
||||
this.fps = fps;
|
||||
}
|
||||
|
||||
@@ -241,6 +266,46 @@ public class OnStreamChangedHookParam extends HookParam{
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getFrames() {
|
||||
return frames;
|
||||
}
|
||||
|
||||
public void setFrames(int frames) {
|
||||
this.frames = frames;
|
||||
}
|
||||
|
||||
public int getKey_frames() {
|
||||
return key_frames;
|
||||
}
|
||||
|
||||
public void setKey_frames(int key_frames) {
|
||||
this.key_frames = key_frames;
|
||||
}
|
||||
|
||||
public int getGop_size() {
|
||||
return gop_size;
|
||||
}
|
||||
|
||||
public void setGop_size(int gop_size) {
|
||||
this.gop_size = gop_size;
|
||||
}
|
||||
|
||||
public int getGop_interval_ms() {
|
||||
return gop_interval_ms;
|
||||
}
|
||||
|
||||
public void setGop_interval_ms(int gop_interval_ms) {
|
||||
this.gop_interval_ms = gop_interval_ms;
|
||||
}
|
||||
|
||||
public float getLoss() {
|
||||
return loss;
|
||||
}
|
||||
|
||||
public void setLoss(float loss) {
|
||||
this.loss = loss;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OriginSock{
|
||||
|
||||
Reference in New Issue
Block a user