修复录制计划以来全局录像配置, 目前去除依赖,目前录制计划开启录像

pull/1769/head
lin 2025-02-11 11:08:52 +08:00
parent 547432e194
commit 3fe131eed3
12 changed files with 65 additions and 43 deletions

View File

@ -35,10 +35,12 @@ public class InviteInfo {
private Long createTime; private Long createTime;
private Boolean record;
public static InviteInfo getInviteInfo(String deviceId, Integer channelId, String stream, SSRCInfo ssrcInfo, String mediaServerId, public static InviteInfo getInviteInfo(String deviceId, Integer channelId, String stream, SSRCInfo ssrcInfo, String mediaServerId,
String receiveIp, Integer receivePort, String streamMode, String receiveIp, Integer receivePort, String streamMode,
InviteSessionType type, InviteSessionStatus status) { InviteSessionType type, InviteSessionStatus status, Boolean record) {
InviteInfo inviteInfo = new InviteInfo(); InviteInfo inviteInfo = new InviteInfo();
inviteInfo.setDeviceId(deviceId); inviteInfo.setDeviceId(deviceId);
inviteInfo.setChannelId(channelId); inviteInfo.setChannelId(channelId);
@ -50,6 +52,7 @@ public class InviteInfo {
inviteInfo.setType(type); inviteInfo.setType(type);
inviteInfo.setStatus(status); inviteInfo.setStatus(status);
inviteInfo.setMediaServerId(mediaServerId); inviteInfo.setMediaServerId(mediaServerId);
inviteInfo.setRecord(record);
return inviteInfo; return inviteInfo;
} }

View File

@ -3,7 +3,10 @@ package com.genersoft.iot.vmp.gb28181.controller;
import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.security.JwtUtils; import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.DeviceType;
import com.genersoft.iot.vmp.gb28181.bean.IndustryCodeType;
import com.genersoft.iot.vmp.gb28181.bean.NetworkIdentificationType;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupByGbDeviceParam; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupByGbDeviceParam;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupParam; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToGroupParam;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionByGbDeviceParam; import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelToRegionByGbDeviceParam;
@ -29,7 +32,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.async.DeferredResult; import org.springframework.web.context.request.async.DeferredResult;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.sip.message.Response;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
@ -261,7 +263,7 @@ public class CommonChannelController {
result.setResult(WVPResult.fail(code, msg)); result.setResult(WVPResult.fail(code, msg));
} }
}; };
channelPlayService.play(channel, null, callback); channelPlayService.play(channel, null, userSetting.getRecordSip(), callback);
return result; return result;
} }
} }

View File

@ -10,11 +10,11 @@ public interface IGbChannelPlayService {
void start(CommonGBChannel channel, InviteInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback); void start(CommonGBChannel channel, InviteInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback);
void play(CommonGBChannel channel, Platform platform, ErrorCallback<StreamInfo> callback); void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback);
void playGbDeviceChannel(CommonGBChannel channel, ErrorCallback<StreamInfo> callback); void playGbDeviceChannel(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
void playProxy(CommonGBChannel channel, ErrorCallback<StreamInfo> callback); void playProxy(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback); void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback);
} }

View File

@ -64,7 +64,7 @@ public interface IPlayService {
void stop(InviteInfo inviteInfo); void stop(InviteInfo inviteInfo);
void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback); void play(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback);
void playBack(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback); void playBack(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback<StreamInfo> callback);

View File

@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.common.enums.ChannelDataType; import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.InviteInfo; import com.genersoft.iot.vmp.gb28181.bean.InviteInfo;
import com.genersoft.iot.vmp.gb28181.bean.Platform; import com.genersoft.iot.vmp.gb28181.bean.Platform;
@ -9,7 +10,6 @@ import com.genersoft.iot.vmp.gb28181.bean.PlayException;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService; import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
import com.genersoft.iot.vmp.gb28181.service.IPlayService; import com.genersoft.iot.vmp.gb28181.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService; import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService; import com.genersoft.iot.vmp.streamPush.service.IStreamPushPlayService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -31,6 +31,9 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Autowired @Autowired
private IStreamPushPlayService streamPushPlayService; private IStreamPushPlayService streamPushPlayService;
@Autowired
private UserSetting userSetting;
@Override @Override
public void start(CommonGBChannel channel, InviteInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) { public void start(CommonGBChannel channel, InviteInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) {
@ -40,7 +43,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
} }
log.info("[点播通用通道] 类型:{} 通道: {}({})", inviteInfo.getSessionName(), channel.getGbName(), channel.getGbDeviceId()); log.info("[点播通用通道] 类型:{} 通道: {}({})", inviteInfo.getSessionName(), channel.getGbName(), channel.getGbDeviceId());
if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) { if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) {
play(channel, platform, callback); play(channel, platform, userSetting.getRecordSip(), callback);
}else if ("Playback".equals(inviteInfo.getSessionName())) { }else if ("Playback".equals(inviteInfo.getSessionName())) {
if (channel.getDataType() == ChannelDataType.GB28181.value) { if (channel.getDataType() == ChannelDataType.GB28181.value) {
// 国标通道 // 国标通道
@ -90,13 +93,13 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
} }
@Override @Override
public void play(CommonGBChannel channel, Platform platform, ErrorCallback<StreamInfo> callback) { public void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback<StreamInfo> callback) {
if (channel.getDataType() == ChannelDataType.GB28181.value) { if (channel.getDataType() == ChannelDataType.GB28181.value) {
// 国标通道 // 国标通道
playGbDeviceChannel(channel, callback); playGbDeviceChannel(channel, record, callback);
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) { } else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
// 拉流代理 // 拉流代理
playProxy(channel, callback); playProxy(channel, record, callback);
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) { } else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
if (platform != null) { if (platform != null) {
// 推流 // 推流
@ -113,10 +116,10 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
} }
@Override @Override
public void playGbDeviceChannel(CommonGBChannel channel, ErrorCallback<StreamInfo> callback){ public void playGbDeviceChannel(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback){
// 国标通道 // 国标通道
try { try {
deviceChannelPlayService.play(channel, callback); deviceChannelPlayService.play(channel, record, callback);
} catch (PlayException e) { } catch (PlayException e) {
callback.run(e.getCode(), e.getMsg(), null); callback.run(e.getCode(), e.getMsg(), null);
} catch (Exception e) { } catch (Exception e) {
@ -126,10 +129,10 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
} }
@Override @Override
public void playProxy(CommonGBChannel channel, ErrorCallback<StreamInfo> callback){ public void playProxy(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback){
// 拉流代理通道 // 拉流代理通道
try { try {
streamProxyPlayService.start(channel.getDataDeviceId(), callback); streamProxyPlayService.start(channel.getDataDeviceId(), record, callback);
}catch (Exception e) { }catch (Exception e) {
callback.run(Response.BUSY_HERE, "busy here", null); callback.run(Response.BUSY_HERE, "busy here", null);
} }

View File

@ -543,7 +543,7 @@ public class PlatformServiceImpl implements IPlatformService {
// 初始化redis中的invite消息状态 // 初始化redis中的invite消息状态
InviteInfo inviteInfo = InviteInfo.getInviteInfo(platform.getServerGBId(), channel.getGbId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(), InviteInfo inviteInfo = InviteInfo.getInviteInfo(platform.getServerGBId(), channel.getGbId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(),
mediaServerItem.getSdpIp(), ssrcInfo.getPort(), userSetting.getBroadcastForPlatform(), InviteSessionType.BROADCAST, mediaServerItem.getSdpIp(), ssrcInfo.getPort(), userSetting.getBroadcastForPlatform(), InviteSessionType.BROADCAST,
InviteSessionStatus.ready); InviteSessionStatus.ready, userSetting.getRecordSip());
inviteStreamService.updateInviteInfo(inviteInfo); inviteStreamService.updateInviteInfo(inviteInfo);
String timeOutTaskKey = UUID.randomUUID().toString(); String timeOutTaskKey = UUID.randomUUID().toString();
dynamicTask.startDelay(timeOutTaskKey, () -> { dynamicTask.startDelay(timeOutTaskKey, () -> {

View File

@ -305,11 +305,11 @@ public class PlayServiceImpl implements IPlayService {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道"); throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道");
} }
return play(mediaServerItem, device, channel, ssrc, callback); return play(mediaServerItem, device, channel, ssrc, userSetting.getRecordSip(), callback);
} }
private SSRCInfo play(MediaServer mediaServerItem, Device device, DeviceChannel channel, String ssrc, private SSRCInfo play(MediaServer mediaServerItem, Device device, DeviceChannel channel, String ssrc, Boolean record,
ErrorCallback<StreamInfo> callback) { ErrorCallback<StreamInfo> callback) {
if (mediaServerItem == null ) { if (mediaServerItem == null ) {
if (callback != null) { if (callback != null) {
callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(), callback.run(InviteErrorCode.ERROR_FOR_PARAMETER_ERROR.getCode(),
@ -322,7 +322,8 @@ public class PlayServiceImpl implements IPlayService {
InviteInfo inviteInfoInCatch = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId()); InviteInfo inviteInfoInCatch = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
if (inviteInfoInCatch != null ) { if (inviteInfoInCatch != null ) {
if (inviteInfoInCatch.getStreamInfo() == null) { if (inviteInfoInCatch.getStreamInfo() == null) {
// 释放生成的ssrc使用上一次申请的 // 释放生成的ssrc使用上一次申请的322
ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrc); ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrc);
// 点播发起了但是尚未成功, 仅注册回调等待结果即可 // 点播发起了但是尚未成功, 仅注册回调等待结果即可
inviteStreamService.once(InviteSessionType.PLAY, channel.getId(), null, callback); inviteStreamService.once(InviteSessionType.PLAY, channel.getId(), null, callback);
@ -432,7 +433,13 @@ public class PlayServiceImpl implements IPlayService {
// 初始化redis中的invite消息状态 // 初始化redis中的invite消息状态
InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(), InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(),
mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.PLAY, mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.PLAY,
InviteSessionStatus.ready); InviteSessionStatus.ready, userSetting.getRecordSip());
if (record != null) {
inviteInfo.setRecord(record);
}else {
inviteInfo.setRecord(userSetting.getRecordSip());
}
inviteStreamService.updateInviteInfo(inviteInfo); inviteStreamService.updateInviteInfo(inviteInfo);
try { try {
@ -812,7 +819,7 @@ public class PlayServiceImpl implements IPlayService {
// 初始化redis中的invite消息状态 // 初始化redis中的invite消息状态
InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(), InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(),
mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.PLAYBACK, mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.PLAYBACK,
InviteSessionStatus.ready); InviteSessionStatus.ready, userSetting.getRecordSip());
inviteStreamService.updateInviteInfo(inviteInfo); inviteStreamService.updateInviteInfo(inviteInfo);
try { try {
@ -1018,7 +1025,7 @@ public class PlayServiceImpl implements IPlayService {
// 初始化redis中的invite消息状态 // 初始化redis中的invite消息状态
InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(), InviteInfo inviteInfo = InviteInfo.getInviteInfo(device.getDeviceId(), channel.getId(), ssrcInfo.getStream(), ssrcInfo, mediaServerItem.getId(),
mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.DOWNLOAD, mediaServerItem.getSdpIp(), ssrcInfo.getPort(), device.getStreamMode(), InviteSessionType.DOWNLOAD,
InviteSessionStatus.ready); InviteSessionStatus.ready, true);
inviteStreamService.updateInviteInfo(inviteInfo); inviteStreamService.updateInviteInfo(inviteInfo);
try { try {
@ -1647,7 +1654,7 @@ public class PlayServiceImpl implements IPlayService {
} }
@Override @Override
public void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback) { public void play(CommonGBChannel channel, Boolean record, ErrorCallback<StreamInfo> callback) {
Device device = deviceService.getDevice(channel.getDataDeviceId()); Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) { if (device == null) {
log.warn("[点播] 未找到通道{}的设备信息", channel); log.warn("[点播] 未找到通道{}的设备信息", channel);
@ -1659,7 +1666,7 @@ public class PlayServiceImpl implements IPlayService {
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
} }
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId()); DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
play(mediaServer, device, deviceChannel, null, callback); play(mediaServer, device, deviceChannel, null, record, callback);
} }
@Override @Override

View File

@ -129,17 +129,19 @@ public class MediaServiceImpl implements IMediaService {
ResultForOnPublish result = new ResultForOnPublish(); ResultForOnPublish result = new ResultForOnPublish();
result.setEnable_audio(true); result.setEnable_audio(true);
// 是否录像
if ("rtp".equals(app)) {
result.setEnable_mp4(userSetting.getRecordSip());
} else {
result.setEnable_mp4(userSetting.getRecordPushLive());
}
// 国标流 // 国标流
if ("rtp".equals(app)) { if ("rtp".equals(app)) {
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, stream); InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, stream);
if (inviteInfo != null) {
result.setEnable_mp4(inviteInfo.getRecord());
}else {
result.setEnable_mp4(userSetting.getRecordSip());
}
result.setEnable_mp4(inviteInfo.getRecord());
// 单端口模式下修改流 ID // 单端口模式下修改流 ID
if (!mediaServer.isRtpEnable() && inviteInfo == null) { if (!mediaServer.isRtpEnable() && inviteInfo == null) {
String ssrc = String.format("%010d", Long.parseLong(stream, 16)); String ssrc = String.format("%010d", Long.parseLong(stream, 16));
@ -190,8 +192,12 @@ public class MediaServiceImpl implements IMediaService {
} }
} else if (app.equals("broadcast")) { } else if (app.equals("broadcast")) {
result.setEnable_audio(true); result.setEnable_audio(true);
result.setEnable_mp4(userSetting.getRecordSip());
} else if (app.equals("talk")) { } else if (app.equals("talk")) {
result.setEnable_audio(true); result.setEnable_audio(true);
result.setEnable_mp4(userSetting.getRecordSip());
}else {
result.setEnable_mp4(userSetting.getRecordPushLive());
} }
if (app.equalsIgnoreCase("rtp")) { if (app.equalsIgnoreCase("rtp")) {
String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_RTP_INFO + userSetting.getServerId() + "_" + stream; String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_RTP_INFO + userSetting.getServerId() + "_" + stream;

View File

@ -66,7 +66,7 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
return; return;
} }
// 开启点播, // 开启点播,
channelPlayService.play(channel, null, ((code, msg, streamInfo) -> { channelPlayService.play(channel, null, true, ((code, msg, streamInfo) -> {
if (code == InviteErrorCode.SUCCESS.getCode() && streamInfo != null) { if (code == InviteErrorCode.SUCCESS.getCode() && streamInfo != null) {
log.info("[录像] 流离开时拉起需要录像的流, 开启成功, 通道ID: {}", channel.getGbId()); log.info("[录像] 流离开时拉起需要录像的流, 开启成功, 通道ID: {}", channel.getGbId());
recordStreamMap.put(channel.getGbId(), streamInfo); recordStreamMap.put(channel.getGbId(), streamInfo);
@ -110,7 +110,7 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
// 查找是否已经开启录像, 如果没有则开启录像 // 查找是否已经开启录像, 如果没有则开启录像
for (CommonGBChannel channel : channelList) { for (CommonGBChannel channel : channelList) {
// 开启点播, // 开启点播,
channelPlayService.play(channel, null, ((code, msg, streamInfo) -> { channelPlayService.play(channel, null, true, ((code, msg, streamInfo) -> {
if (code == InviteErrorCode.SUCCESS.getCode() && streamInfo != null) { if (code == InviteErrorCode.SUCCESS.getCode() && streamInfo != null) {
log.info("[录像] 开启成功, 通道ID: {}", channel.getGbId()); log.info("[录像] 开启成功, 通道ID: {}", channel.getGbId());
recordStreamMap.put(channel.getGbId(), streamInfo); recordStreamMap.put(channel.getGbId(), streamInfo);

View File

@ -187,7 +187,7 @@ public class StreamProxyController {
@Parameter(name = "id", description = "代理Id", required = true) @Parameter(name = "id", description = "代理Id", required = true)
public StreamContent start(int id){ public StreamContent start(int id){
log.info("播放代理: {}", id); log.info("播放代理: {}", id);
StreamInfo streamInfo = streamProxyPlayService.start(id); StreamInfo streamInfo = streamProxyPlayService.start(id, null, null);
if (streamInfo == null) { if (streamInfo == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg()); throw new ControllerException(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg());
}else { }else {

View File

@ -6,7 +6,7 @@ import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
public interface IStreamProxyPlayService { public interface IStreamProxyPlayService {
StreamInfo start(int id); StreamInfo start(int id, Boolean record, ErrorCallback<StreamInfo> callback);
void start(int id, ErrorCallback<StreamInfo> callback); void start(int id, ErrorCallback<StreamInfo> callback);

View File

@ -14,11 +14,6 @@ import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService; import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyPlayService;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.ConcurrentHashMap;
import javax.sip.message.Response;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
@ -27,6 +22,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import javax.sip.message.Response;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* *
*/ */
@ -90,11 +88,14 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
} }
@Override @Override
public StreamInfo start(int id) { public StreamInfo start(int id, Boolean record, ErrorCallback<StreamInfo> callback) {
StreamProxy streamProxy = streamProxyMapper.select(id); StreamProxy streamProxy = streamProxyMapper.select(id);
if (streamProxy == null) { if (streamProxy == null) {
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到"); throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");
} }
if (record != null) {
streamProxy.setEnableMp4(record);
}
return startProxy(streamProxy); return startProxy(streamProxy);
} }