app 统一用 rtp

This commit is contained in:
xugo
2025-11-24 23:27:23 +08:00
parent 0bc60bdca5
commit 63d91e08df
2 changed files with 4 additions and 6 deletions
+1 -4
View File
@@ -62,12 +62,9 @@ func (c *Core) AddStreamProxy(ctx context.Context, in *AddStreamProxyInput) (*St
if err := copier.Copy(&out, in); err != nil {
slog.ErrorContext(ctx, "Copy", "err", err)
}
if in.App == "rtp" {
return nil, reason.ErrBadRequest.With("请更换 app 参数")
}
out.ID = c.uniqueID.UniqueID(bz.IDPrefixRTSP)
out.Stream = out.ID
out.App = "pull"
out.App = "rtp"
if err := c.store.StreamProxy().Add(ctx, &out); err != nil {
if orm.IsDuplicatedKey(err) {
return nil, reason.ErrDB.SetMsg("stream 重复,请勿重复添加")
+3 -2
View File
@@ -161,10 +161,11 @@ func (w WebHookAPI) onRTPServerTimeout(c *gin.Context, in *onRTPServerTimeoutInp
return newDefaultOutputOK(), nil
}
// onStreamNotFound 流不存在事件
// TODO: 重启后立即播放,会出发 "channel not exist" 待处理
func (w WebHookAPI) onStreamNotFound(c *gin.Context, in *onStreamNotFoundInput) (DefaultOutput, error) {
w.log.InfoContext(c.Request.Context(), "webhook onStreamNotFound", "app", in.App, "stream", in.Stream, "schema", in.Schema, "mediaServerID", in.MediaServerID)
// 防止重复触发
if in.Schema != "rtmp" {
if !(in.Schema == "rtmp" || in.Schema == "rtsp") {
return newDefaultOutputOK(), nil
}