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