GithubHelp home page GithubHelp logo

plugin-gb28181's People

Contributors

bosscheng avatar charlestamz avatar duiniuluantanqin avatar dwdcth avatar geekchengz avatar hongri8488 avatar huhusen avatar kingecg avatar langhuihui avatar ogofly avatar pggiroro avatar sshwsfc avatar yangchao2015 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plugin-gb28181's Issues

没有GPS定位

设备上线后,好像没有订阅GPS定位消息,导致接收不到定位数据

time.After mem++

	sse.WriteJSON(list)
	select {
	case <-time.After(time.Second * 5):
	case <-sse.Done():
		return
	}

restful的这里建议NewTimer,确保超时内存能及时释放
sse.WriteJSON(list)
timeOut := time.NewTimer(time.Second * 5)
defer timeOut.Stop()
select {
case <-timeOut.C:
case <-sse.Done():
return
}
同样的server.go建议增加
t := time.NewTicker(time.Duration(config.RemoveBanInterval) * time.Second)
defer t.Stop() //新增

TP-Link的无线摄像头与国标28181插件通信,无法autoinvite

局域网下可以成功通信,但是插件发送的invite消息出现可稳定复现的超时,只有极小的概率成功。
发送的消息如下
writing SIP message to UDP 192.168.0.108:5061 {"plugin": "GB28181", "prefix": "transport.Protocol", "connection_key": ""udp:0.0.0.0:5060"", "sip_server_ptr": ""0xc00021de00"", "protocol_ptr": ""0xc00024aa00"", "connection_ptr": ""0xc000314380"", "request_id": ""779f96d4-370d-4e54-a3af-83294d32a154"", "transport": ""UDP"", "source": ""192.168.0.106:5060"", "destination": ""192.168.0.108:5061"", "transport_layer_ptr": ""0xc00021dea0"", "transaction_ptr": ""0xc000244240"", "transaction_key": ""z9hG4bK.Dmv5akDdDsm8aLOsmeB8fT7mbnQgcUVf__INVITE""}

得到的报错如下(master分支暂时没有打印报错log,这个是自己改的)
do SipRequestForResponse faild transaction.TxTimeoutError<transaction_key=z9hG4bK.Dmv5akDdDsm8aLOsmeB8fT7mbnQgcUVf__INVITE transaction_ptr=0xc000244240>: transaction timed out

关于设备注册的问题

按照GB28181附录J或者SIP协议,设备在SIP服务器注册成功,服务器返回的200相应中应该是有Contact这一头部字段的,但是目前版本插件是没有的,导致注册成功服务器返回给设备的报文是200 OK (0bingdings),而正常的应该是200OK (1bingdings),所以希望插件在返回的报文里添加Contact这一头部字段,这样就返回正确了

使用GB28181协议在订阅后流被断开该如何解决

使用设备为海康摄像头,配置如下:
image
config.yaml配置如下

llhls:
  enable: false
hls:
  enable: false
monitor:
  enable: false

global:
  pulseinterval: 5s # 心跳事件间隔时间

gb28181:
  invitemode:     1 #0、手动invite 1、表示自动发起invite,当Server(SIP)接收到设备信息时,立即向设备发送invite命令获取流,2、按需拉流,既等待订阅者触发
  position:
    autosubposition: false #是否自动订阅定位
    expires: 3600s #订阅周期(单位:秒),默认3600
    interval: 61s #订阅间隔(单位:秒),默认6
  sipip:          "" #sip服务器地址 默认 自动适配设备网段
  serial:         "34020000001110000001"
  realm:          "3402000000"
  username:       "34020000001110000001"
  password:       "12345678"
  registervalidity:  80s #注册有效期
  mediaip:          "" #媒体服务器地址 默认 自动适配设备网段
  port:
    sip: udp:5060 #sip服务器端口
    media: tcp:58200-59200 #媒体服务器端口,用于接收设备的流

  removebaninterval: 10m #定时移除注册失败的设备黑名单,单位秒,默认10分钟(600秒)
  loglevel:         debug

启用monibuca进程,查看8080/gb28181/api/list API接口返回如下:

[
  {
    "Channels": [
      {
        "Address": "192.168.254.3",
        "CivilCode": "CivilCode",
        "DeviceID": "34020000001310000001",
        "GpsTime": "0001-01-01T00:00:00Z",
        "Latitude": "",
        "LiveStatus": 0,
        "LiveSubSP": "",
        "Longitude": "",
        "Manufacturer": "Manufacturer",
        "Model": "Camera",
        "Name": "优曼测试",
        "Owner": "Owner",
        "ParentID": "",
        "Parental": 0,
        "Port": 0,
        "RegisterWay": 1,
        "SafetyWay": 0,
        "Secrecy": 0,
        "Status": "ON"
      },
      {
        "Address": "192.168.254.19",
        "CivilCode": "CivilCode",
        "DeviceID": "34020000001310000002",
        "GpsTime": "0001-01-01T00:00:00Z",
        "Latitude": "",
        "LiveStatus": 0,
        "LiveSubSP": "",
        "Longitude": "",
        "Manufacturer": "Manufacturer",
        "Model": "Camera",
        "Name": "Camera 01",
        "Owner": "Owner",
        "ParentID": "",
        "Parental": 0,
        "Port": 0,
        "RegisterWay": 1,
        "SafetyWay": 0,
        "Secrecy": 0,
        "Status": "OFF"
      }
    ],
    "ID": "34020000001110000001",
    "Name": "Network Video Recorder",
    "Manufacturer": "HIKVISION",
    "Model": "DS-7816N-R2/16P",
    "Owner": "",
    "RegisterTime": "2024-01-21T14:54:08.084150099+08:00",
    "UpdateTime": "2024-01-21T15:06:18.120260297+08:00",
    "LastKeepaliveAt": "2024-01-21T15:06:18.120381176+08:00",
    "Status": "ONLINE",
    "SN": 3,
    "SipIP": "172.18.156.34",
    "MediaIP": "172.18.156.34",
    "NetAddr": "171.106.18.191:62977",
    "GpsTime": "0001-01-01T00:00:00Z",
    "Longitude": "",
    "Latitude": ""
  }
]

访问:8080/preview/34020000001110000001/34020000001310000001播放视频流失败,STD输出如下:

15:13:57        DEBUG   Preview visit   {"path": "/preview/34020000001110000001/decoder-pro-hard.js", "remote": "222.71.242.202:56737"}
15:13:57        DEBUG   Preview visit   {"path": "/preview/34020000001110000001/decoder-pro-audio.wasm", "remote": "222.71.242.202:56737"}
15:13:58        DEBUG   HDL     visit   {"path": "/hdl/34020000001110000001/34020000001310000001.flv", "remote": "222.71.242.202:56737"}
15:13:58        INFO    已创建  {"流": "34020000001110000001/34020000001310000001", "id": 1}
15:13:58        DEBUG   warp context    {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737"}
15:13:58        INFO    订阅    {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737"}
15:13:58        DEBUG   GB28181 TryAutoInvite   {"id": "34020000001110000001", "channel": "34020000001310000001", "opt": "t=0 0", "condition": true}
15:13:58        INFO    订阅者+1        {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737", "remains": 1}
15:13:58        INFO    GB28181 invite response {"id": "34020000001110000001", "channel": "34020000001310000001", "status code": 200}
15:13:58        DEBUG   GB28181 Device support tcp      {"id": "34020000001110000001", "channel": "34020000001310000001"}
15:13:58        DEBUG   found   {"流": "34020000001110000001/34020000001310000001", "id": 1}
15:13:58        DEBUG   create context  {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "PSPublisher"}
15:13:58        INFO    发布    {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "PSPublisher", "ptr": "0xc000c135e0"}
15:13:58        INFO    ⌛->🟡    {"流": "34020000001110000001/34020000001310000001", "id": 1, "动作": "publish"}
15:13:58        INFO    tcp listen 1 at :58200
15:14:03        WARN    no tracks       {"流": "34020000001110000001/34020000001310000001", "id": 1}
15:14:03        INFO    🟡->🔴    {"流": "34020000001110000001/34020000001310000001", "id": 1, "动作": "timeout"}
15:14:03        INFO    close   {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "HDLSubscriber", "ID": "222.71.242.202:56737", "event": "close"}
15:14:03        INFO    close   {"流": "34020000001110000001/34020000001310000001", "id": 1, "类型": "PSPublisher", "event": "close"}

观察到的现象:
当播放失败后,8080/gb28181/api/list这个API的返回对象就会变为[]空数组
目前看起来连接是建立了,从报错内容来看是没有收到推流数据,想请教一下该如何排查问题。
服务器上的端口已经全部开放(1-60999)

对讲支持

您好,
准备在利用该插件实现语音推送(摄像头播放).实现流程如下:
1)前端页面向sip服务发送HTTP请求(摄像头ID作为参数)。
2)sip服务接收到前端页面请求后根据ID查询到对应的摄像头设备,发送SIP广播通知,并接收摄像头的广播应答。应答中包含摄像头的IP地址,端口号,音频编码信息。
3)sip服务向流媒体服务发送HTTP请求,携带要发送的摄像头RTP相关信息。流媒体服务发送前端音频流。
4)前端页面接收到步骤1的HTTP返回后,进行拾音操作,将PCM格式的音频流发送给流媒体服务。
5)流媒体服务将接收到的PCM音频流转码为PCMA格式。
6)流媒体服务将PCMA音频数据进行RTP封装,以UDP的方式发送到对应的摄像头。
这个插件内置的sip server, sip通信都没有问题. 有个问题是: 步骤3 是插件同monibuca之间通信吗?这个该如何实现?
谢谢

求助

GB28181互联网视频传输,丢帧乱码,怎么解决。

GB28181接入常见问题

这里记录一下GB28181接入的常见问题

SIP/2.0 400 Bad request

国标编码不一致,在nvr或者摄像头的国标配置页;外域编码需要配置和Monibuca一致

SIP/2.0 487 Request Terminated

国标编码问题,nvr的本机的11-13位国标编码需要为200,并修改摄像机11-13位的为131,Monibuca编码为120
还有可能是nvr配置Monibuca的国标编码和国标域反了

【bug】两个tplink的摄像头,但是只能播放一个

image

image

image

不知道为啥就timeout了

15:27:50	INFO	tcp listen 1 at :58201
15:28:00	WARN	no tracks	{"stream": "34020000001320000001/34020000001320000001"}
15:28:00	INFO	🟢->⌛	{"stream": "34020000001320000001/34020000001320000001", "action": "publish lost"}
15:28:00	DEBUG	wait publisher	{"stream": "34020000001320000001/34020000001320000001", "wait timeout": "10ms"}
15:28:00	DEBUG	timeout	{"stream": "34020000001320000001/34020000001320000001", "state": "⌛"}
15:28:00	INFO->🔴	{"stream": "34020000001320000001/34020000001320000001", "action": "timeout"}

image

image

感觉并发有问题

image

海康摄像机使用gb28181报错

panic: runtime error: slice bounds out of range [:-1]

goroutine 120 [running]:
m7s.live/plugin/gb28181/v4.(*GB28181Config).StoreDevice(0x1937440, {0xc000757645, 0x14}, {0x1235158, 0xc000c286e0}, 0xc00074d8e0)
/home/runner/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/device.go:88 +0x705
m7s.live/plugin/gb28181/v4.(*GB28181Config).OnRegister(0x1937440, {0x1235158?, 0xc000c286e0}, {0x7f635cf23318, 0xc000c07b80})
/home/runner/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/handle.go:95 +0x3f2
created by github.com/ghettovoice/gosip.(*server).handleRequest
/home/runner/go/pkg/mod/github.com/ghettovoice/[email protected]/server.go:270 +0x28a

panic错误

panic: runtime error: slice bounds out of range [:9] with length 0

goroutine 1616 [running]:
m7s.live/plugin/gb28181/v4.(*Channel).CreateRequst(0xc0013ae1c0, {0xe6cbab, 0x6})
	/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/channel.go:100 +0x725
m7s.live/plugin/gb28181/v4.(*Channel).Invite(0xc0013ae1c0, {0x0, 0x0, {0x0, 0x0}, {0xc000804b50, 0xa}, 0xbebd2f1, 0xe358})
	/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/channel.go:358 +0xbbc
created by m7s.live/plugin/gb28181/v4.(*Device).UpdateChannels
	/go/pkg/mod/m7s.live/plugin/gb28181/[email protected]/device.go:245 +0x9b6

求助 使用教程

直接在main。go 引用就行吗?我试了 运行不起来,请问有详细的教程吗 新手不懂怎么操作,有 demo 提供吗

V4没有AutoCloseAfter配置?

AutoCloseAfter 如果设置大于等于0,则当某个流最后一个订阅者取消订阅时会延迟N秒,会自动发送bye,节省流量。如果为了响应及时,可以设置成-1,保持流的连接

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.