ossrs / srs-gb28181

GB28181 server based on SRS
https://ossrs.net
MIT License
83 stars 41 forks source link

GB28181: SRS 60路摄像头推流转发为hls后频繁奔溃 #2624 #12

Open winlinvip opened 2 years ago

winlinvip commented 2 years ago

注意:不提供以下信息的Issue会被直接删除(Please follow issue template, or we will delete it)

注意:咨询和讨论请提交到SRS星球(Please ask question at) http://bbs.ossrs.net

描述(Description)

描述你遇到了什么问题(Please description your issue here) SRS 60路海康摄像头rtsp使用的gb28181协议rtsp推流转发为hls后频繁奔溃

  1. SRS版本(Version): 4.0.123
  2. SRS的日志如下(Log): image 110736 [2021-09-22 11:12:25.262][Trace][19309][5p973922] TCP: before dispose resource(HttpStream)(0x29d6f10), conns=3, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:12:25.262][Warn][19309][5p973922][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:12:25.262][Trace][19309][57qp6832] TCP: clear zombies=1 resources, conns=3, removing=0, unsubs=0 [2021-09-22 11:12:25.262][Trace][19309][5p973922] TCP: disposing #0 resource(HttpStream)(0x29d6f10), conns=3, disposing=1, zombies=0 [2021-09-22 11:12:25.262][Trace][19309][q6jh5687] TCP: before dispose resource(HttpStream)(0x199f6b0), conns=2, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:12:25.262][Warn][19309][q6jh5687][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:12:25.262][Trace][19309][57qp6832] TCP: clear zombies=1 resources, conns=2, removing=0, unsubs=0 [2021-09-22 11:12:25.262][Trace][19309][q6jh5687] TCP: disposing #0 resource(HttpStream)(0x199f6b0), conns=2, disposing=1, zombies=0 [2021-09-22 11:12:25.276][Trace][19309][l2166cq0] TCP: before dispose resource(HttpStream)(0x1ff1d60), conns=1, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:12:25.277][Warn][19309][l2166cq0][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:12:25.277][Trace][19309][57qp6832] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0 [2021-09-22 11:12:25.277][Trace][19309][l2166cq0] TCP: disposing #0 resource(HttpStream)(0x1ff1d60), conns=1, disposing=1, zombies=0 [2021-09-22 11:12:26.107][Trace][19309][43m5f9w5] HTTP #0 172.22.21.83:59365 GET http://210.26.109.164:8080/live/34020000001320000029@34020000001320000001.m3u8, content-length=-1 [2021-09-22 11:12:26.107][Trace][19309][43m5f9w5] http match file=./objs/nginx/html/live/34020000001320000029@34020000001320000001.m3u8, pattern=/, upath=/live/34020000001320000029@34020000001320000001.m3u8 [2021-09-22 11:12:26.112][Trace][19309][5f7l5527] HTTP #0 172.22.21.83:59366 GET http://210.26.109.164:8080/live/34020000001320000029@34020000001320000001.m3u8, content-length=-1 [2021-09-22 11:12:26.112][Trace][19309][5f7l5527] http match file=./objs/nginx/html/live/34020000001320000029@34020000001320000001.m3u8, pattern=/, upath=/live/34020000001320000029@34020000001320000001.m3u8 [2021-09-22 11:12:26.118][Trace][19309][0r430mm5] HTTP #0 172.22.21.83:59367 GET http://210.26.109.164:8080/live/34020000001320000029@34020000001320000001.m3u8, content-length=-1 [2021-09-22 11:12:26.118][Trace][19309][0r430mm5] http match file=./objs/nginx/html/live/34020000001320000029@34020000001320000001.m3u8, pattern=/, upath=/live/34020000001320000029@34020000001320000001.m3u8 [2021-09-22 11:12:26.166][Trace][19309][0r430mm5] TCP: before dispose resource(HttpStream)(0x20525c0), conns=3, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:12:26.166][Warn][19309][0r430mm5][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:12:26.166][Trace][19309][57qp6832] TCP: clear zombies=1 resources, conns=3, removing=0, unsubs=0 [2021-09-22 11:12:26.166][Trace][19309][0r430mm5] TCP: disposing #0 resource(HttpStream)(0x20525c0), conns=3, disposing=1, zombies=0 [2021-09-22 11:12:26.167][Trace][19309][5f7l5527] TCP: before dispose resource(HttpStream)(0x1937fc0), conns=2, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:12:26.167][Warn][19309][5f7l5527][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:12:26.168][Trace][19309][57qp6832] TCP: clear zombies=1 resources, conns=2, removing=0, unsubs=0 [2021-09-22 11:12:26.168][Trace][19309][5f7l5527] TCP: disposing #0 resource(HttpStream)(0x1937fc0), conns=2, disposing=1, zombies=0 [2021-09-22 11:12:26.168][Trace][19309][43m5f9w5] TCP: before dispose resource(HttpStream)(0x254d680), conns=1, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:12:26.168][Warn][19309][43m5f9w5][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:12:26.168][Trace][19309][57qp6832] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0 [2021-09-22 11:12:26.168][Trace][19309][43m5f9w5] TCP: disposing #0 resource(HttpStream)(0x254d680), conns=1, disposing=1, zombies=0 [2021-09-22 11:12:26.293][Trace][19309][l53jdyz3] Hybrid cpu=38.04%,49MB, cid=66,24, timer=61,0,0, clock=1,35,11,1,0,0,0,0,0, free=3, objs=(pkt:3077,raw:240,fua:2815,msg:6065,oth:20,buf:20) [2021-09-22 11:12:26.485][Trace][19309][s1i4849z] gb28181: sip session=34020000002000000065 peer(192.168.198.65, 5060) status(RegisterOk,AliveOk) duration(65,60) 114312 [2021-09-22 11:43:12.166][Trace][20266][hg891704] TCP: before dispose resource(HttpStream)(0x22c5ea0), conns=8, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:43:12.166][Warn][20266][hg891704][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:43:12.167][Trace][20266][74ovog53] TCP: clear zombies=1 resources, conns=8, removing=0, unsubs=0 [2021-09-22 11:43:12.167][Trace][20266][hg891704] TCP: disposing #0 resource(HttpStream)(0x22c5ea0), conns=8, disposing=1, zombies=0 [2021-09-22 11:43:12.182][Trace][20266][a3i9l9iv] TCP: before dispose resource(HttpStream)(0x3202030), conns=7, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:43:12.182][Warn][20266][a3i9l9iv][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:43:12.182][Trace][20266][0d25vh01] TCP: before dispose resource(HttpStream)(0x1a1e220), conns=7, zombies=1, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:43:12.182][Warn][20266][0d25vh01][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:43:12.182][Trace][20266][74ovog53] TCP: clear zombies=2 resources, conns=7, removing=0, unsubs=0 [2021-09-22 11:43:12.182][Trace][20266][a3i9l9iv] TCP: disposing #0 resource(HttpStream)(0x3202030), conns=7, disposing=2, zombies=0 [2021-09-22 11:43:12.182][Trace][20266][0d25vh01] TCP: disposing #1 resource(HttpStream)(0x1a1e220), conns=6, disposing=2, zombies=0 [2021-09-22 11:43:12.202][Trace][20266][00j7g9se] TCP: before dispose resource(HttpStream)(0x13c7440), conns=5, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:43:12.202][Warn][20266][00j7g9se][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:43:12.202][Trace][20266][74ovog53] TCP: clear zombies=1 resources, conns=5, removing=0, unsubs=0 [2021-09-22 11:43:12.202][Trace][20266][00j7g9se] TCP: disposing #0 resource(HttpStream)(0x13c7440), conns=5, disposing=1, zombies=0 [2021-09-22 11:43:12.205][Trace][20266][20sy9ksr] HTTP #0 210.26.107.2:60463 GET http://210.26.109.164:8080/live/34020000002000000021@34020000001320000001-265.ts, content-length=-1 [2021-09-22 11:43:12.205][Trace][20266][20sy9ksr] http match file=./objs/nginx/html/live/34020000002000000021@34020000001320000001-265.ts, pattern=/, upath=/live/34020000002000000021@34020000001320000001-265.ts [2021-09-22 11:43:12.210][Trace][20266][g1682g22] HTTP #0 210.26.107.2:50972 GET http://210.26.109.164:8080/live/34020000002000000020@34020000001320000001-264.ts, content-length=-1 [2021-09-22 11:43:12.210][Trace][20266][g1682g22] http match file=./objs/nginx/html/live/34020000002000000020@34020000001320000001-264.ts, pattern=/, upath=/live/34020000002000000020@34020000001320000001-264.ts [2021-09-22 11:43:12.280][Trace][20266][00c5za09] HTTP #0 210.26.107.2:61002 GET http://210.26.109.164:8080/live/34020000001320000026@34020000001320000001-270.ts, content-length=-1 [2021-09-22 11:43:12.280][Trace][20266][00c5za09] http match file=./objs/nginx/html/live/34020000001320000026@34020000001320000001-270.ts, pattern=/, upath=/live/34020000001320000026@34020000001320000001-270.ts [2021-09-22 11:43:12.411][Trace][20266][724km0j4] TCP: before dispose resource(HttpStream)(0x4ba8630), conns=7, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:43:12.411][Warn][20266][724km0j4][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:43:12.411][Trace][20266][74ovog53] TCP: clear zombies=1 resources, conns=7, removing=0, unsubs=0 [2021-09-22 11:43:12.411][Trace][20266][724km0j4] TCP: disposing #0 resource(HttpStream)(0x4ba8630), conns=7, disposing=1, zombies=0 [2021-09-22 11:43:12.503][Trace][20266][78z86fu8] HTTP #0 210.26.107.2:50184 GET http://210.26.109.164:8080/live/34020000001320000023@34020000001320000001-271.ts, content-length=-1 ^[[33m[2021-09-22 11:43:12.503][Warn][20266][78z86fu8][2] http miss file=./objs/nginx/html/live/34020000001320000023@34020000001320000001-271.ts, pattern=/, upath=/live/34020000001320000023@34020000001320000001-271.ts ^[[0m[2021-09-22 11:43:12.781][Trace][20266][78z86fu8] TCP: before dispose resource(HttpStream)(0x420ca10), conns=7, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:43:12.781][Warn][20266][78z86fu8][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:43:12.784][Trace][20266][74ovog53] TCP: clear zombies=1 resources, conns=7, removing=0, unsubs=0 [2021-09-22 11:43:12.784][Trace][20266][78z86fu8] TCP: disposing #0 resource(HttpStream)(0x420ca10), conns=7, disposing=1, zombies=0 srs: src/kernel/srs_kernel_buffer.cpp:113: void SrsBuffer::skip(int): Assertion `p + size <= bytes + nb_bytes' failed. 115904 [2021-09-22 11:59:02.189][Trace][25220][p74k13pd] TCP: before dispose resource(HttpStream)(0x3d43020), conns=6, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:59:02.189][Warn][25220][p74k13pd][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:59:02.189][Trace][25220][ds96593i] TCP: before dispose resource(HttpStream)(0x33fe870), conns=6, zombies=1, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:59:02.189][Warn][25220][ds96593i][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:59:02.189][Trace][25220][7098166z] TCP: clear zombies=2 resources, conns=6, removing=0, unsubs=0 [2021-09-22 11:59:02.189][Trace][25220][p74k13pd] TCP: disposing #0 resource(HttpStream)(0x3d43020), conns=6, disposing=2, zombies=0 [2021-09-22 11:59:02.189][Trace][25220][ds96593i] TCP: disposing #1 resource(HttpStream)(0x33fe870), conns=5, disposing=2, zombies=0 [2021-09-22 11:59:02.205][Trace][25220][sd0ap60u] TCP: before dispose resource(HttpStream)(0x3e80fd0), conns=4, zombies=0, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:59:02.205][Warn][25220][sd0ap60u][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:59:02.205][Trace][25220][fn3l8zfx] TCP: before dispose resource(HttpStream)(0x4667110), conns=4, zombies=1, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:59:02.205][Warn][25220][fn3l8zfx][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:59:02.205][Trace][25220][kof57k2k] TCP: before dispose resource(HttpStream)(0x296a820), conns=4, zombies=2, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:59:02.205][Warn][25220][kof57k2k][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:59:02.205][Trace][25220][sh780a66] TCP: before dispose resource(HttpStream)(0x42683c0), conns=4, zombies=3, ign=0, inz=0, ind=0 ^[[33m[2021-09-22 11:59:02.205][Warn][25220][sh780a66][104] client disconnect peer. ret=1007 ^[[0m[2021-09-22 11:59:02.205][Trace][25220][7098166z] TCP: clear zombies=4 resources, conns=4, removing=0, unsubs=0 [2021-09-22 11:59:02.205][Trace][25220][sd0ap60u] TCP: disposing #0 resource(HttpStream)(0x3e80fd0), conns=4, disposing=4, zombies=0 [2021-09-22 11:59:02.205][Trace][25220][fn3l8zfx] TCP: disposing #1 resource(HttpStream)(0x4667110), conns=3, disposing=4, zombies=0 [2021-09-22 11:59:02.205][Trace][25220][kof57k2k] TCP: disposing #2 resource(HttpStream)(0x296a820), conns=2, disposing=4, zombies=0 [2021-09-22 11:59:02.205][Trace][25220][sh780a66] TCP: disposing #3 resource(HttpStream)(0x42683c0), conns=1, disposing=4, zombies=0 [2021-09-22 11:59:02.224][Trace][25220][1z579yzj] gb28181: sip session=34020000001320000078 peer(192.168.198.78, 5060) status(RegisterOk,AliveOk) duration(786,0) [2021-09-22 11:59:02.300][Trace][25220][2v35fu7q] gb28181: sip session=34020000002000000071 peer(192.168.198.71, 5060) status(RegisterOk,AliveOk) duration(786,1) [2021-09-22 11:59:02.300][Trace][25220][ia504368] gb28181: sip session=34020000001320000047 peer(192.168.198.47, 5060) status(RegisterOk,AliveOk) duration(786,0) [2021-09-22 11:59:02.383][Trace][25220][vdr35t1i] -> HLS time=761197881ms, sno=127, ts=34020000002000000075@34020000001320000001-126.ts, dur=0.00, dva=5356p [2021-09-22 11:59:02.802][Trace][25220][xd794500] gb28181: sip session=34020000001320000049 peer(192.168.198.49, 5060) status(RegisterOk,AliveOk) duration(786,1) [2021-09-22 11:59:03.514][Trace][25220][740w7269] gb28181: client_id 34020000001320000028@34020000001320000001, unkonw ps data (0x2d79b0e/16146000) d7 52 3d 92

[2021-09-22 11:59:03.514][Trace][25220][740w7269] gb28181: client_id 34020000001320000028@34020000001320000001 decode ps packet error (0x2d79b0e/16146000)! ps_size=68820 complete=66060

[2021-09-22 11:59:03.803][Trace][25220][0o330c03] gb28181: sip session=34020000002000000052 peer(192.168.198.52, 5060) status(RegisterOk,AliveOk) duration(785,0) [2021-09-22 11:59:04.459][Trace][25220][92o1h923] Hybrid cpu=38.96%,59MB, cid=53,17, timer=60,0,0, clock=1,33,9,2,1,1,0,0,0, free=2, objs=(pkt:3322,raw:236,fua:3064,msg:6537,oth:21,buf:21) [2021-09-22 11:59:04.461][Trace][25220][27p0czq3] gb28181: ps map audio es_type=svac(9b), es_id=da, es_info_length=15359 srs: src/kernel/srs_kernel_buffer.cpp:113: void SrsBuffer::skip(int): Assertion `p + size <= bytes + nb_bytes' failed.

  1. SRS的配置如下(Config):

    push gb28181 stream to SRS.

listen 1935; max_connections 1000; daemon off; srs_log_tank console;

http_api { enabled on; listen 1985; }

http_server { enabled on; listen 8080; }

stats { network 0; }

stream_caster { enabled on; caster gb28181;

# 转发流到rtmp服务器地址与端口
# TODO: https://github.com/ossrs/srs/pull/1679/files#r400875104
# [stream] is VideoChannelCodecID(视频通道编码ID) for sip
# 自动创建的道通[stream] 是‘chid[ssrc]’ [ssrc]是rtp的ssrc
# [ssrc] rtp中的ssrc
output              rtmp://127.0.0.1:1935/live/[stream];

# 接收设备端rtp流的多路复用端口
listen              9000;
# 多路复用端口类型,on为tcp,off为udp
# 默认:on
tcp_enable            on;

# rtp接收监听端口范围,最小值
rtp_port_min        58200;
# rtp接收监听端口范围,最大值
rtp_port_max        58300;

wait_keyframe       on;

rtp_idle_timeout    30;
audio_enable        off;
jitterbuffer_enable  off;
host       $CANDIDATE;

#根据收到ps rtp包自带创建rtmp媒体通道,不需要api接口创建
#rtmp地址参数[stream] 就是通道id  格式chid[ssrc]
auto_create_channel   off;

sip {
    enabled on;
    listen              5060;
    serial              34020000002000000001;

    # SIP server domain(SIP服务器域)
    realm               3402000000;

    # 服务端发送ack后,接收回应的超时时间,单位为秒
    # 如果指定时间没有回应,认为失败
    ack_timeout         30;
    keepalive_timeout   120;
    auto_play           on;
    invite_port_fixed     on;
    query_catalog_interval  60;
}

}

rtc_server { enabled on;

Listen at udp://8000

listen          8000;
candidate       $CANDIDATE;

}

vhost defaultVhost { rtc { enabled on; bframe discard; }

hls {
    enabled         on;
    hls_path        ./objs/nginx/html;
    hls_fragment    5;
    hls_window      15;
    hls_dispose     600;
}

http_remux { enabled on; mount [vhost]/[app]/[stream].flv; } }

重现(Replay)

重现Bug的步骤(How to replay bug?)

期望行为(Expect)

描述你期望发生的事情(Please describe your expectation) 稳定不宕机