mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-09-27 01:15:52 +08:00
Compare commits
3 Commits
48a17138d0
...
e7a6f0bba5
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e7a6f0bba5 | ||
![]() |
4f75725a0e | ||
![]() |
ae698c7b5a |
@@ -133,6 +133,8 @@ func (gb *GB28181Plugin) List(ctx context.Context, req *pb.GetDevicesRequest) (*
|
||||
Port: int32(d.Port),
|
||||
BroadcastPushAfterAck: d.BroadcastPushAfterAck,
|
||||
SubscribeCatalog: util.Conditional(d.SubscribeCatalog == 0, false, true),
|
||||
SubscribePosition: util.Conditional(d.SubscribePosition == 0, false, true),
|
||||
SubscribeAlarm: util.Conditional(d.SubscribeAlarm == 0, false, true),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -564,7 +566,7 @@ func (gb *GB28181Plugin) UpdateDevice(ctx context.Context, req *pb.Device) (*pb.
|
||||
d.PositionSubscribeTask.Tick(nil)
|
||||
} else {
|
||||
if d.PositionSubscribeTask != nil {
|
||||
d.CatalogSubscribeTask.Tick(nil)
|
||||
d.PositionSubscribeTask.Tick(nil)
|
||||
d.PositionSubscribeTask.Ticker.Reset(time.Hour * 999999)
|
||||
}
|
||||
}
|
||||
@@ -2895,7 +2897,7 @@ func (gb *GB28181Plugin) UpdateChannel(ctx context.Context, req *pb.UpdateChanne
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
gb.Info("通道信息已更新",
|
||||
gb.Debug("通道信息已更新",
|
||||
"通道ID", req.Id,
|
||||
"自定义通道ID", channel.DeviceChannel.CustomChannelId,
|
||||
"自定义名称", channel.DeviceChannel.CustomName)
|
||||
|
@@ -364,8 +364,12 @@ func (d *Device) onMessage(req *sip.Request, tx sip.ServerTransaction, msg *gb28
|
||||
d.Model = msg.Model
|
||||
d.Firmware = msg.Firmware
|
||||
d.UpdateTime = time.Now()
|
||||
d.Latitude = msg.Latitude
|
||||
d.Longitude = msg.Longitude
|
||||
if msg.Latitude != "" {
|
||||
d.Latitude = msg.Latitude
|
||||
}
|
||||
if msg.Longitude != "" {
|
||||
d.Longitude = msg.Longitude
|
||||
}
|
||||
case "Alarm":
|
||||
// 创建报警记录
|
||||
alarm := &gb28181.DeviceAlarm{
|
||||
@@ -766,8 +770,12 @@ func (d *Device) onNotify(req *sip.Request, tx sip.ServerTransaction, msg *gb281
|
||||
gpsTime = gpsTime.UTC()
|
||||
|
||||
// 更新设备的经纬度信息
|
||||
d.Longitude = fmt.Sprintf("%.6f", posNotify.Longitude)
|
||||
d.Latitude = fmt.Sprintf("%.6f", posNotify.Latitude)
|
||||
if posNotify.Longitude != 0 {
|
||||
d.Longitude = fmt.Sprintf("%.6f", posNotify.Longitude)
|
||||
}
|
||||
if posNotify.Latitude != 0 {
|
||||
d.Latitude = fmt.Sprintf("%.6f", posNotify.Latitude)
|
||||
}
|
||||
d.UpdateTime = time.Now()
|
||||
|
||||
// 如果需要,可以将更新保存到数据库
|
||||
|
@@ -327,6 +327,7 @@ func (task *registerHandlerTask) RecoverDevice(d *Device, req *sip.Request) {
|
||||
//}
|
||||
task.gb.DB.Save(d)
|
||||
}
|
||||
d.catalog()
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ func (rt *AcceptPushTask) Start() error {
|
||||
}
|
||||
// 添加视频编码参数
|
||||
if !rt.testCase.AudioOnly {
|
||||
args = append(args, "-c:v", rt.testCase.VideoCodec)
|
||||
args = append(args, "-c:v", rt.testCase.VideoCodec, "-b:v", "200k")
|
||||
} else {
|
||||
args = append(args, "-vn")
|
||||
}
|
||||
|
@@ -299,6 +299,10 @@ func (s *Server) Start() (err error) {
|
||||
s.Error("failed to connect database", "error", err, "dsn", s.config.DSN, "type", s.config.DBType)
|
||||
return
|
||||
}
|
||||
sqlDB, _ := s.DB.DB()
|
||||
sqlDB.SetMaxIdleConns(25)
|
||||
sqlDB.SetMaxOpenConns(100)
|
||||
sqlDB.SetConnMaxLifetime(5 * time.Minute)
|
||||
// Auto-migrate models
|
||||
if err = s.DB.AutoMigrate(&db.User{}, &PullProxyConfig{}, &PushProxyConfig{}, &StreamAliasDB{}, &AlarmInfo{}); err != nil {
|
||||
s.Error("failed to auto-migrate models", "error", err)
|
||||
|
Reference in New Issue
Block a user