srs
srs copied to clipboard
多次重复推流,导致srs偶尔没有on_publish回调
Description(描述) 1.推流端断流后偶尔连续多次回调on_unpublish:
[2022-05-23 09:55:41.716][Warn][336111][25dbt266][0] http: ignore on_unpublish failed, client_id=25dbt266, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"25dbt266","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
2.推流端断流后重新推流导致srs偶尔没有on_publish回调: 在如下日志中tv.qntv.net/channellive/ch1流http_hooks 回调on_unpublish 后,没有回调on_publish,直接回调了on_hls
[2022-05-23 09:55:41.720][Trace][336111][7r541816] http: on_hls ok, client_id=7r541816, url=http://127.0.0.1:8080/api/on_hls, request={"server_id":"vid-kl3et78","action":"on_hls","client_id":"7r541816","ip":"223.80.226.33","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"","duration":13.84,"cwd":"/opt/srs","file":"./media/data/channellive/ch1/seg/Num206367.ts","url":"data/channellive/ch1/seg/Num206367.ts","m3u8":"./media/data/channellive/ch1/playlist.m3u8","m3u8_url":"data/channellive/ch1/playlist.m3u8","seq_no":206367}, response={
"code" : 0,
"data" : "success"
}
-
SRS Version(版本): 4.0.233
-
SRS Log(日志):
[2022-05-23 09:55:39.776][Trace][336111][h4a34730] ignore AMF0/AMF3 command message.
[2022-05-23 09:55:39.898][Trace][336111][4qo47t9y] -> PLA time=1278155606, msgs=128, okbps=2233,0,2237, ikbps=0,0,0, mw=350/8
[2022-05-23 09:55:39.898][Trace][336111][h4a34730] ignore AMF0/AMF3 command message.
[2022-05-23 09:55:39.898][Trace][336111][h4a34730] client identified, type=rtmp-play, vhost=tv.qntv.net, app=channellive, stream=ch2, param=, duration=-1ms
[2022-05-23 09:55:39.898][Trace][336111][h4a34730] connected stream, tcUrl=rtmp://tv.qntv.net:1935/channellive, pageUrl=, swfUrl=, schema=rtmp, vhost=tv.qntv.net, port=1935, app=channellive, stream=ch2, param=, args=null
[2022-05-23 09:55:39.898][Trace][336111][h4a34730] source url=tv.qntv.net/channellive/ch2, ip=223.73.233.94, cache=1, is_edge=0, source_id=/2150g75j
[2022-05-23 09:55:39.898][Trace][336111][h4a34730] create consumer, active=0, queue_size=0.00, jitter=30000000
[2022-05-23 09:55:39.899][Trace][336111][h4a34730] set fd=41, SO_SNDBUF=46080=>175000, buffer=350ms
[2022-05-23 09:55:39.899][Trace][336111][h4a34730] start play smi=0ms, mw_sleep=350, mw_msgs=8, realtime=0, tcp_nodelay=0
[2022-05-23 09:55:40.536][Trace][336111][6a18x428] stream consumer change pause state 0=>1
[2022-05-23 09:55:40.714][Trace][336111][1t862r39] http: on_publish ok, client_id=1t862r39, url=http://127.0.0.1:8080/api/on_publish, request={"server_id":"vid-kl3et78","action":"on_publish","client_id":"1t862r39","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","tcUrl":"rtmp://172.17.60.104:1935/channellive?vhost=tv.qntv.net","stream":"ch2","param":"?vhost=tv.qntv.net"}, response={
"code" : 0,
"data" : "success"
}
[2022-05-23 09:55:40.714][Trace][336111][1t862r39] hls: win=50000ms, frag=5000ms, prefix=, path=./media, m3u8=data/[app]/[stream]/playlist.m3u8, ts=data/[app]/[stream]/seg/Num[seq].ts, aof=2.00, floor=0, clean=1, waitk=1, dispose=0ms, dts_directly=1
[2022-05-23 09:55:40.714][Trace][336111][1t862r39] ignore disabled exec for vhost=tv.qntv.net
[2022-05-23 09:55:40.714][Trace][336111][1t862r39] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0
[2022-05-23 09:55:40.714][Trace][336111][1t862r39] got metadata, width=1920, height=1080, vcodec=7, acodec=10
[2022-05-23 09:55:40.714][Trace][336111][1t862r39] 59B video sh, codec(7, profile=High, level=Other, 128x2144, 0kbps, 0.0fps, 0.0s)
[2022-05-23 09:55:40.714][Trace][336111][1t862r39] 4B audio sh, codec(10, profile=LC, 2channels, 0kbps, 44100HZ), flv(16bits, 2channels, 44100HZ)
[2022-05-23 09:55:40.715][Trace][336111][5n2fa852] update source_id=1t862r39/2150g75j
[2022-05-23 09:55:40.716][Trace][336111][213jv53b] update source_id=1t862r39/2150g75j
[2022-05-23 09:55:40.716][Trace][336111][y2l2c8m7] update source_id=1t862r39/2150g75j
[2022-05-23 09:55:40.716][Trace][336111][290rbm4p] update source_id=1t862r39/2150g75j
[2022-05-23 09:55:40.716][Trace][336111][676a3138] update source_id=1t862r39/2150g75j
[2022-05-23 09:55:40.716][Trace][336111][0272207l] update source_id=1t862r39/2150g75j
[2022-05-23 09:55:40.716][Trace][336111][h4a34730] update source_id=1t862r39/2150g75j
[2022-05-23 09:55:41.037][Trace][336111][6a18x428] stream consumer change pause state 1=>0
[2022-05-23 09:55:41.670][Trace][336111][y2l2c8m7] TCP: before dispose resource(RtmpConn)(0x241f090), conns=34, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.670][Warn][336111][y2l2c8m7][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.670][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=34, removing=0, unsubs=0
[2022-05-23 09:55:41.670][Trace][336111][y2l2c8m7] TCP: disposing #0 resource(RtmpConn)(0x241f090), conns=34, disposing=1, zombies=0
[2022-05-23 09:55:41.716][Trace][336111][1574b52p] http: on_unpublish ok, client_id=1574b52p, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"1574b52p","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"?vhost=tv.qntv.net"}, response={
"code" : 0,
"data" : "success"
}
[2022-05-23 09:55:41.716][Trace][336111][1574b52p] TCP: before dispose resource(RtmpConn)(0x23f2820), conns=33, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.716][Warn][336111][1574b52p][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.716][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=33, removing=0, unsubs=0
[2022-05-23 09:55:41.716][Trace][336111][1574b52p] TCP: disposing #0 resource(RtmpConn)(0x23f2820), conns=33, disposing=1, zombies=0
[2022-05-23 09:55:41.716][Trace][336111][6q78o933] http: on_unpublish ok, client_id=6q78o933, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"6q78o933","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch2","param":"?vhost=tv.qntv.net"}, response={
"code" : 0,
"data" : "success"
}
[2022-05-23 09:55:41.716][Trace][336111][6q78o933] TCP: before dispose resource(RtmpConn)(0x321ccf0), conns=32, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.716][Warn][336111][6q78o933][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.716][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=32, removing=0, unsubs=0
[2022-05-23 09:55:41.716][Trace][336111][6q78o933] TCP: disposing #0 resource(RtmpConn)(0x321ccf0), conns=32, disposing=1, zombies=0
[2022-05-23 09:55:41.716][Warn][336111][25dbt266][0] http: ignore on_unpublish failed, client_id=25dbt266, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"25dbt266","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
, status=200, ret=3064
[2022-05-23 09:55:41.717][Trace][336111][25dbt266] TCP: before dispose resource(RtmpConn)(0x2919600), conns=31, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.717][Warn][336111][25dbt266][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.717][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=31, removing=0, unsubs=0
[2022-05-23 09:55:41.717][Trace][336111][25dbt266] TCP: disposing #0 resource(RtmpConn)(0x2919600), conns=31, disposing=1, zombies=0
[2022-05-23 09:55:41.717][Warn][336111][87b67w06][0] http: ignore on_unpublish failed, client_id=87b67w06, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"87b67w06","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch2","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
, status=200, ret=3064
[2022-05-23 09:55:41.717][Trace][336111][87b67w06] TCP: before dispose resource(RtmpConn)(0x26550b0), conns=30, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.717][Warn][336111][87b67w06][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.717][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=30, removing=0, unsubs=0
[2022-05-23 09:55:41.717][Trace][336111][87b67w06] TCP: disposing #0 resource(RtmpConn)(0x26550b0), conns=30, disposing=1, zombies=0
[2022-05-23 09:55:41.717][Warn][336111][6lg1032q][0] http: ignore on_unpublish failed, client_id=6lg1032q, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"6lg1032q","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
, status=200, ret=3064
[2022-05-23 09:55:41.717][Trace][336111][6lg1032q] TCP: before dispose resource(RtmpConn)(0x2464a00), conns=29, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.717][Warn][336111][6lg1032q][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.717][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=29, removing=0, unsubs=0
[2022-05-23 09:55:41.717][Trace][336111][6lg1032q] TCP: disposing #0 resource(RtmpConn)(0x2464a00), conns=29, disposing=1, zombies=0
[2022-05-23 09:55:41.717][Warn][336111][fj2skhr1][0] http: ignore on_unpublish failed, client_id=fj2skhr1, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"fj2skhr1","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch2","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
, status=200, ret=3064
[2022-05-23 09:55:41.717][Trace][336111][fj2skhr1] TCP: before dispose resource(RtmpConn)(0x26e5580), conns=28, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.717][Warn][336111][fj2skhr1][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.717][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=28, removing=0, unsubs=0
[2022-05-23 09:55:41.717][Trace][336111][fj2skhr1] TCP: disposing #0 resource(RtmpConn)(0x26e5580), conns=28, disposing=1, zombies=0
[2022-05-23 09:55:41.717][Warn][336111][f98i1s73][0] http: ignore on_unpublish failed, client_id=f98i1s73, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"f98i1s73","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
[2022-05-23 09:55:41.719][Trace][336111][b23426m6] TCP: before dispose resource(RtmpConn)(0x2996f50), conns=20, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.719][Warn][336111][b23426m6][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.719][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=20, removing=0, unsubs=0
[2022-05-23 09:55:41.719][Trace][336111][b23426m6] TCP: disposing #0 resource(RtmpConn)(0x2996f50), conns=20, disposing=1, zombies=0
[2022-05-23 09:55:41.719][Warn][336111][7q0fb5s3][0] http: ignore on_unpublish failed, client_id=7q0fb5s3, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"7q0fb5s3","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
, status=200, ret=3064
[2022-05-23 09:55:41.719][Trace][336111][7q0fb5s3] TCP: before dispose resource(RtmpConn)(0x2426e00), conns=19, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.719][Warn][336111][7q0fb5s3][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.719][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=19, removing=0, unsubs=0
[2022-05-23 09:55:41.719][Trace][336111][7q0fb5s3] TCP: disposing #0 resource(RtmpConn)(0x2426e00), conns=19, disposing=1, zombies=0
[2022-05-23 09:55:41.719][Warn][336111][2150g75j][0] http: ignore on_unpublish failed, client_id=2150g75j, url=http://127.0.0.1:8080/api/on_unpublish, request={"server_id":"vid-kl3et78","action":"on_unpublish","client_id":"2150g75j","ip":"172.17.60.201","vhost":"tv.qntv.net","app":"channellive","stream":"ch2","param":"?vhost=tv.qntv.net"}, response={
"code" : -1,
"data" : ""
}
, status=200, ret=3064
[2022-05-23 09:55:41.719][Trace][336111][2150g75j] TCP: before dispose resource(RtmpConn)(0x3a735c0), conns=18, zombies=0, ign=0, inz=0, ind=0
[2022-05-23 09:55:41.719][Warn][336111][2150g75j][32] client disconnect peer. ret=1009
[2022-05-23 09:55:41.719][Trace][336111][l2457284] TCP: clear zombies=1 resources, conns=18, removing=0, unsubs=0
[2022-05-23 09:55:41.719][Trace][336111][2150g75j] TCP: disposing #0 resource(RtmpConn)(0x3a735c0), conns=18, disposing=1, zombies=0
[2022-05-23 09:55:41.720][Trace][336111][7r541816] http: on_hls ok, client_id=7r541816, url=http://127.0.0.1:8080/api/on_hls, request={"server_id":"vid-kl3et78","action":"on_hls","client_id":"7r541816","ip":"223.80.226.33","vhost":"tv.qntv.net","app":"channellive","stream":"ch1","param":"","duration":13.84,"cwd":"/opt/srs","file":"./media/data/channellive/ch1/seg/Num206367.ts","url":"data/channellive/ch1/seg/Num206367.ts","m3u8":"./media/data/channellive/ch1/playlist.m3u8","m3u8_url":"data/channellive/ch1/playlist.m3u8","seq_no":206367}, response={
"code" : 0,
"data" : "success"
}
[2022-05-23 09:55:41.720][Trace][336111][1t862r39] http: on_hls ok, client_id=1t862r39, url=http://127.0.0.1:8080/api/on_hls, request={"server_id":"vid-kl3et78","action":"on_hls","client_id":"1t862r39","ip":"223.73.233.94","vhost":"tv.qntv.net","app":"channellive","stream":"ch2","param":"","duration":14.72,"cwd":"/opt/srs","file":"./media/data/channellive/ch2/seg/Num206127.ts","url":"data/channellive/ch2/seg/Num206127.ts","m3u8":"./media/data/channellive/ch2/playlist.m3u8","m3u8_url":"data/channellive/ch2/playlist.m3u8","seq_no":206127}, response={
"code" : 0,
"data" : "success"
}
- SRS Config(配置):
# main config for srs.
# @see full.conf for detail config.
listen 1935;
max_connections 1000;
srs_log_tank file;
srs_log_file ./log/srs.log;
pid ./pid/srs.pid;
# ==============================================================================================
# http api 服务器
http_api {
enabled on;
listen 7999;
crossdomain on;
}
# ==============================================================================================
# http-flv、http-aac 服务器
http_server {
enabled on;
listen 8100;
crossdomain on;
}
vhost tv.lpsntv.com {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
dvr {
enabled off;
}
hls {
enabled on;
hls_fragment 5;
hls_window 50;
hls_path ./media;
hls_m3u8_file data/[app]/[stream]/playlist.m3u8;
hls_ts_file data/[app]/[stream]/seg/Num[seq].ts;
}
http_hooks {
enabled on;
on_publish http://127.0.0.1:8080/api/on_publish;
on_unpublish http://127.0.0.1:8080/api/on_unpublish;
on_hls http://127.0.0.1:8080/api/on_hls;
}
}
vhost radio.lpsntv.com {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].aac;
}
dvr {
enabled off;
}
hls {
enabled on;
hls_fragment 5;
hls_window 50;
hls_path ./media;
hls_m3u8_file data/[app]/[stream]/playlist.m3u8;
hls_ts_file data/[app]/[stream]/seg/Num[seq].ts;
hls_vcodec vn;
}
http_hooks {
enabled on;
on_publish http://127.0.0.1:8080/api/on_publish;
on_unpublish http://127.0.0.1:8080/api/on_unpublish;
on_hls http://127.0.0.1:8080/api/on_hls;
}
}
vhost live.lpsntv.com {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
dvr {
enabled off;
}
hls {
enabled on;
hls_fragment 5;
hls_window 50;
hls_path ./media;
hls_m3u8_file data/[app]/[stream]/playlist.m3u8;
hls_ts_file data/[app]/[stream]/seg/Num[seq].ts;
}
http_hooks {
enabled on;
on_publish http://127.0.0.1:8080/api/on_publish;
on_unpublish http://127.0.0.1:8080/api/on_unpublish;
on_hls http://127.0.0.1:8080/api/on_hls;
}
}
Replay(重现)
不好重现,估计是编码器反复断流推流导致的
Expect(期望行为)
How long is the interval for the encoder to repeat the streaming?
TRANS_BY_GPT3
200 milliseconds
TRANS_BY_GPT3