支持发送流没找到事件

pull/1411/head
648540858 2024-03-26 23:16:08 +08:00
parent 1ce30e6656
commit f218d7bbd6
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,64 @@
package com.genersoft.iot.vmp.media.event;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServer;
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamNotFoundHookParam;
import org.springframework.context.ApplicationEvent;
/**
*
*/
public class MediaNotFoundEvent extends ApplicationEvent {
public MediaNotFoundEvent(Object source) {
super(source);
}
private String app;
private String stream;
private MediaServer mediaServer;
private String schema;
public static MediaNotFoundEvent getInstance(Object source, OnStreamNotFoundHookParam hookParam, MediaServer mediaServer){
MediaNotFoundEvent mediaDepartureEven = new MediaNotFoundEvent(source);
mediaDepartureEven.setApp(hookParam.getApp());
mediaDepartureEven.setStream(hookParam.getStream());
mediaDepartureEven.setSchema(hookParam.getSchema());
mediaDepartureEven.setMediaServer(mediaServer);
return mediaDepartureEven;
}
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public String getStream() {
return stream;
}
public void setStream(String stream) {
this.stream = stream;
}
public MediaServer getMediaServer() {
return mediaServer;
}
public void setMediaServer(MediaServer mediaServer) {
this.mediaServer = mediaServer;
}
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
}

View File

@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.media.bean.ResultForOnPublish;
import com.genersoft.iot.vmp.media.event.MediaArrivalEvent;
import com.genersoft.iot.vmp.media.event.MediaDepartureEvent;
import com.genersoft.iot.vmp.media.event.MediaNotFoundEvent;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.media.zlm.dto.HookType;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServer;
@ -262,6 +263,10 @@ public class ZLMHttpHookListener {
defaultResult.setResult(new HookResult(ErrorCode.ERROR404.getCode(), ErrorCode.ERROR404.getMsg()));
return defaultResult;
}
MediaNotFoundEvent mediaNotFoundEvent = MediaNotFoundEvent.getInstance(this, param, mediaServer);
applicationEventPublisher.publishEvent(mediaNotFoundEvent);
if ("rtp".equals(param.getApp())) {
String[] s = param.getStream().split("_");