临时提交

pull/1642/head
648540858 2024-09-07 22:37:32 +08:00
parent cc302be2f2
commit 3fafe83e88
6 changed files with 22 additions and 12 deletions

View File

@ -51,7 +51,7 @@ public interface IPlayService {
void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
void startPushStream(SendRtpInfo sendRtpItem, SIPResponse sipResponse, Platform platform, CallIdHeader callIdHeader);
void startPushStream(SendRtpInfo sendRtpItem, DeviceChannel channel, SIPResponse sipResponse, Platform platform, CallIdHeader callIdHeader);
void startSendRtpStreamFailHand(SendRtpInfo sendRtpItem, Platform platform, CallIdHeader callIdHeader);

View File

@ -1414,7 +1414,7 @@ public class PlayServiceImpl implements IPlayService {
}
@Override
public void startPushStream(SendRtpInfo sendRtpItem, SIPResponse sipResponse, Platform platform, CallIdHeader callIdHeader) {
public void startPushStream(SendRtpInfo sendRtpItem, DeviceChannel channel, SIPResponse sipResponse, Platform platform, CallIdHeader callIdHeader) {
// 开始发流
MediaServer mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
@ -1425,7 +1425,7 @@ public class PlayServiceImpl implements IPlayService {
} else {
mediaServerService.startSendRtp(mediaInfo, sendRtpItem);
}
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, platform);
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, channel, platform);
}catch (ControllerException e) {
log.error("RTP推流失败: {}", e.getMessage());
startSendRtpStreamFailHand(sendRtpItem, platform, callIdHeader);

View File

@ -4,8 +4,10 @@ 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.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpInfo;
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
@ -63,6 +65,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
@Autowired
private IDeviceService deviceService;
@Autowired
private IDeviceChannelService deviceChannelService;
@Autowired
private IMediaServerService mediaServerService;
@ -103,11 +108,13 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
);
Platform parentPlatform = platformService.queryPlatformByServerGBId(fromUserId);
if (parentPlatform != null) {
DeviceChannel deviceChannel = deviceChannelService.getOneById(sendRtpItem.getChannelId());
if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) {
WVPResult wvpResult = redisRpcService.startSendRtp(sendRtpItem.getRedisKey(), sendRtpItem);
if (wvpResult.getCode() == 0) {
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, parentPlatform);
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, deviceChannel, parentPlatform);
}
} else {
try {
@ -116,7 +123,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
} else {
mediaServerService.startSendRtp(mediaInfo, sendRtpItem);
}
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, parentPlatform);
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, deviceChannel, parentPlatform);
}catch (ControllerException e) {
log.error("RTP推流失败: {}", e.getMessage());
playService.startSendRtpStreamFailHand(sendRtpItem, parentPlatform, callIdHeader);

View File

@ -217,7 +217,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
MediaServer mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId());
try {
mediaServerService.startSendRtpPassive(mediaServer, sendRtpItem, 5);
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, platform);
DeviceChannel deviceChannel = deviceChannelService.getOneById(sendRtpItem.getChannelId());
if (deviceChannel != null) {
redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, deviceChannel, platform);
}
}catch (ControllerException e) {
log.warn("[上级Invite] tcp主动模式 发流失败", e);
sendBye(platform, inviteInfo.getCallId());
@ -911,7 +914,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, broadcastCatch.getApp(), broadcastCatch.getStream());
if (streamReady) {
sendOk(device, sendRtpItem, sdp, request, mediaServerItem, mediaTransmissionTCP, gb28181Sdp.getSsrc());
sendOk(device, deviceChannel, sendRtpItem, sdp, request, mediaServerItem, mediaTransmissionTCP, gb28181Sdp.getSsrc());
} else {
log.warn("[语音通话] 未发现待推送的流,app={},stream={}", broadcastCatch.getApp(), broadcastCatch.getStream());
try {
@ -937,7 +940,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}
}
SIPResponse sendOk(Device device, SendRtpInfo sendRtpItem, SessionDescription sdp, SIPRequest request, MediaServer mediaServerItem, boolean mediaTransmissionTCP, String ssrc) {
SIPResponse sendOk(Device device, DeviceChannel channel, SendRtpInfo sendRtpItem, SessionDescription sdp, SIPRequest request, MediaServer mediaServerItem, boolean mediaTransmissionTCP, String ssrc) {
SIPResponse sipResponse = null;
try {
sendRtpItem.setStatus(2);
@ -986,7 +989,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
// 开启发流大华在收到200OK后就会开始建立连接
if (!device.isBroadcastPushAfterAck()) {
log.info("[语音喊话] 回复200OK后发现 BroadcastPushAfterAck为False现在开始推流");
playService.startPushStream(sendRtpItem, sipResponse, parentPlatform, request.getCallIdHeader());
playService.startPushStream(sendRtpItem, channel, sipResponse, parentPlatform, request.getCallIdHeader());
}
} catch (SipException | InvalidArgumentException | ParseException | SdpParseException e) {

View File

@ -208,7 +208,7 @@ public interface IRedisCatchStorage {
void sendChannelAddOrDelete(String deviceId, String channelId, boolean add);
void sendPlatformStartPlayMsg(SendRtpInfo sendRtpItem, Platform platform);
void sendPlatformStartPlayMsg(SendRtpInfo sendRtpItem, DeviceChannel channel, Platform platform);
void sendPlatformStopPlayMsg(SendRtpInfo sendRtpItem, Platform platform, CommonGBChannel channel);

View File

@ -662,10 +662,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
}
@Override
public void sendPlatformStartPlayMsg(SendRtpInfo sendRtpItem, Platform platform) {
public void sendPlatformStartPlayMsg(SendRtpInfo sendRtpItem, DeviceChannel channel, Platform platform) {
if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && platform != null) {
MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(),
sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
channel.getDeviceId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(),
sendRtpItem.getMediaServerId());
messageForPushChannel.setPlatFormIndex(platform.getId());
String key = VideoManagerConstants.VM_MSG_STREAM_START_PLAY_NOTIFY;