mirror of
https://github.com/gowvp/gb28181.git
synced 2026-04-22 23:17:19 +08:00
support lalmax-pro keepalive
This commit is contained in:
@@ -41,7 +41,7 @@ go wvp 是 Go 语言实现的开源 GB28181 解决方案,基于 GB28181-2022
|
||||
|
||||
+ @夏楚 [ZLMediaKit](https://github.com/ZLMediaKit/ZLMediaKit)
|
||||
|
||||
+ **lalmax-pro 有 golang 流媒体的需求请联系微信 [golangxx](https://github.com/ixugo)**
|
||||
+ **lalmax-pro 有 golang 流媒体的需求请联系微信 [joestar2006](https://github.com/joestarzxh)**
|
||||
- 对环境没有要求,不需要安装任何静态库,支持跨平台编译
|
||||
- 支持特色功能定制
|
||||
- 支持 G711(G711A/G711U) 转 AAC
|
||||
|
||||
@@ -142,7 +142,9 @@ func (l *LalmaxDriver) Setup(ctx context.Context, ms *MediaServer, webhookURL st
|
||||
maxPort, _ = strconv.Atoi(ports[1])
|
||||
}
|
||||
if err := engine.SetHttpNotifyConfig(ctx, lalmax.HttpNotifyConfig{
|
||||
Enable: true,
|
||||
Enable: true,
|
||||
KeepaliveIntervalSec: ms.HookAliveInterval,
|
||||
OnKeepalive: fmt.Sprintf("%s/on_server_keepalive", webhookURL),
|
||||
// OnPubStart: webhookURL,
|
||||
// OnPubStop: webhookURL,
|
||||
OnSubStartWithoutStream: fmt.Sprintf("%s/on_stream_not_found", webhookURL),
|
||||
|
||||
@@ -104,7 +104,7 @@ func (d *ZLMDriver) Setup(ctx context.Context, ms *MediaServer, webhookURL strin
|
||||
HookOnShellLogin: zlm.NewString(""),
|
||||
HookOnStreamChanged: zlm.NewString(fmt.Sprintf("%s/on_stream_changed", webhookURL)),
|
||||
HookOnServerKeepalive: zlm.NewString(fmt.Sprintf("%s/on_server_keepalive", webhookURL)),
|
||||
HookTimeoutSec: zlm.NewString("20"),
|
||||
HookTimeoutSec: zlm.NewString("10"),
|
||||
HookAliveInterval: zlm.NewString(fmt.Sprint(ms.HookAliveInterval)),
|
||||
ProtocolContinuePushMs: zlm.NewString("3000"),
|
||||
RtpProxyPortRange: &ms.RTPPortRange,
|
||||
|
||||
@@ -54,7 +54,8 @@ func registerZLMWebhookAPI(r gin.IRouter, api WebHookAPI, handler ...gin.Handler
|
||||
// onServerKeepalive 服务器定时上报时间,上报间隔可配置,默认 10s 上报一次
|
||||
// https://docs.zlmediakit.com/zh/guide/media_server/web_hook_api.html#_16%E3%80%81on-server-keepalive
|
||||
func (w WebHookAPI) onServerKeepalive(_ *gin.Context, in *onServerKeepaliveInput) (DefaultOutput, error) {
|
||||
w.smsCore.Keepalive(in.MediaServerID)
|
||||
// TODO: 仅支持默认
|
||||
w.smsCore.Keepalive(sms.DefaultMediaServerID)
|
||||
return newDefaultOutputOK(), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +263,8 @@ type HttpApiConfig struct {
|
||||
|
||||
type HttpNotifyConfig struct {
|
||||
Enable bool `json:"enable"`
|
||||
KeepaliveIntervalSec int `json:"keepalive_interval_sec"`
|
||||
OnKeepalive string `json:"on_keepalive"`
|
||||
UpdateIntervalSec int `json:"update_interval_sec"`
|
||||
OnServerStart string `json:"on_server_start"`
|
||||
OnUpdate string `json:"on_update"`
|
||||
@@ -408,9 +410,13 @@ func (e *Engine) SetHttpNotifyConfig(ctx context.Context, config HttpNotifyConfi
|
||||
// 使用合并模式,只更新 http_notify 配置
|
||||
data := map[string]any{
|
||||
"http_notify": config,
|
||||
"rtsp": map[string]any{
|
||||
"pub_not_sub_auto_close_sec": 30,
|
||||
},
|
||||
"gb28181": map[string]any{
|
||||
"enable": false,
|
||||
"media_config": gb28181,
|
||||
"enable": false,
|
||||
"pub_not_sub_auto_close_sec": 30,
|
||||
"media_config": gb28181,
|
||||
},
|
||||
}
|
||||
return e.setServerConfig(ctx, data, true)
|
||||
|
||||
Reference in New Issue
Block a user