648540858
2024-05-29 764d04b497356ba6bcbb75fd42b51eca750f7223
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
old mode 100644 new mode 100755
@@ -7,21 +7,21 @@
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.exception.ServiceException;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,6 +36,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.util.UUID;
@@ -54,13 +56,7 @@
   private SIPCommander cmder;
   @Autowired
   private ZLMRTPServerFactory zlmrtpServerFactory;
   @Autowired
   private IVideoManagerStorage storager;
   @Autowired
   private IRedisCatchStorage redisCatchStorage;
   @Autowired
   private IInviteStreamService inviteStreamService;
@@ -74,7 +70,7 @@
   @Autowired
   private UserSetting userSetting;
   @Operation(summary = "开始视频回放")
   @Operation(summary = "开始视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
   @Parameter(name = "deviceId", description = "设备国标编号", required = true)
   @Parameter(name = "channelId", description = "通道国标编号", required = true)
   @Parameter(name = "startTime", description = "开始时间", required = true)
@@ -107,7 +103,15 @@
                  if (data != null) {
                     StreamInfo streamInfo = (StreamInfo)data;
                     if (userSetting.getUseSourceIpAsStreamIp()) {
                        streamInfo.channgeStreamIp(request.getLocalAddr());
                        streamInfo=streamInfo.clone();//深拷贝
                        String host;
                        try {
                           URL url=new URL(request.getRequestURL().toString());
                           host=url.getHost();
                        } catch (MalformedURLException e) {
                           host=request.getLocalAddr();
                        }
                        streamInfo.channgeStreamIp(host);
                     }
                     wvpResult.setData(new StreamContent(streamInfo));
                  }
@@ -123,7 +127,7 @@
   }
   @Operation(summary = "停止视频回放")
   @Operation(summary = "停止视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
   @Parameter(name = "deviceId", description = "设备国标编号", required = true)
   @Parameter(name = "channelId", description = "通道国标编号", required = true)
   @Parameter(name = "stream", description = "流ID", required = true)
@@ -147,7 +151,7 @@
   }
   @Operation(summary = "回放暂停")
   @Operation(summary = "回放暂停", security = @SecurityRequirement(name = JwtUtils.HEADER))
   @Parameter(name = "streamId", description = "回放流ID", required = true)
   @GetMapping("/pause/{streamId}")
   public void playPause(@PathVariable String streamId) {
@@ -163,7 +167,7 @@
   }
   @Operation(summary = "回放恢复")
   @Operation(summary = "回放恢复", security = @SecurityRequirement(name = JwtUtils.HEADER))
   @Parameter(name = "streamId", description = "回放流ID", required = true)
   @GetMapping("/resume/{streamId}")
   public void playResume(@PathVariable String streamId) {
@@ -178,7 +182,7 @@
   }
   @Operation(summary = "回放拖动播放")
   @Operation(summary = "回放拖动播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
   @Parameter(name = "streamId", description = "回放流ID", required = true)
   @Parameter(name = "seekTime", description = "拖动偏移量,单位s", required = true)
   @GetMapping("/seek/{streamId}/{seekTime}")
@@ -198,7 +202,7 @@
      }
   }
   @Operation(summary = "回放倍速播放")
   @Operation(summary = "回放倍速播放", security = @SecurityRequirement(name = JwtUtils.HEADER))
   @Parameter(name = "streamId", description = "回放流ID", required = true)
   @Parameter(name = "speed", description = "倍速0.25 0.5 1、2、4", required = true)
   @GetMapping("/speed/{streamId}/{speed}")