This commit is contained in:
zxb 2024-03-17 04:40:14 +08:00
parent fb5f42baee
commit 24642eaa8a

View File

@ -24,6 +24,7 @@ import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.github.rholder.retry.*; import com.github.rholder.retry.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
@ -197,11 +198,13 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
AtomicReference<String> failMag = new AtomicReference<>(""); AtomicReference<String> failMag = new AtomicReference<>("");
Retryer<JSONObject> retryer = RetryerBuilder.<JSONObject>newBuilder() Retryer<JSONObject> retryer = RetryerBuilder.<JSONObject>newBuilder()
.retryIfResult(resp -> { .retryIfResult(resp -> {
if(resp != null && resp.getInteger("code") == -1){ if(resp != null){
String msg = resp.getString("msg"); if(resp.getInteger("code") != 0){
if(!msg.equalsIgnoreCase(failMag.get())){ String msg = resp.getString("msg");
failMag.set(msg); if (!msg.equalsIgnoreCase(failMag.get()) && !StringUtils.containsIgnoreCase(msg,"can not find the source stream")) {
logger.debug(msg); failMag.set(msg);
logger.debug("rtp转推失败 {} {}, {}, {}", msg, channelId, mediaInfo, param);
}
} }
} }
return resp == null || resp.getInteger("code") != 0; return resp == null || resp.getInteger("code") != 0;
@ -211,13 +214,13 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
// 重试间隔 // 重试间隔
.withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.MILLISECONDS)) .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.MILLISECONDS))
// 重试次数 // 重试次数
.withStopStrategy(StopStrategies.stopAfterAttempt(15 * 1000)) .withStopStrategy(StopStrategies.stopAfterAttempt(10 * 1000))
.build(); .build();
try { try {
startSendRtpStreamResult = retryer.call(() -> zlmServerFactory.startSendRtpStream(mediaInfo, param)); startSendRtpStreamResult = retryer.call(() -> zlmServerFactory.startSendRtpStream(mediaInfo, param));
logger.info("rtp转推成功 {} {} {}", channelId, mediaInfo, param); logger.info("rtp转推成功 {} {} {}", channelId, mediaInfo, param);
} catch (ExecutionException | RetryException e) { } catch (ExecutionException | RetryException e) {
logger.error("rtp转推失败 {} {} {} {}", channelId, mediaInfo, param, e.getMessage()); logger.error("rtp转推失败 {} {} {} => {} {}", channelId, mediaInfo, param, failMag.get(), e.getMessage());
startSendRtpStreamResult = null; startSendRtpStreamResult = null;
} }
startSendRtpStreamHand(evt, sendRtpItem, parentPlatform, startSendRtpStreamResult, param, callIdHeader); startSendRtpStreamHand(evt, sendRtpItem, parentPlatform, startSendRtpStreamResult, param, callIdHeader);