ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.32k stars 5.33k forks source link

The number of clients in the '/api/v1/streams' interface is incorrect. #3530

Closed songxian43 closed 1 year ago

songxian43 commented 1 year ago

Note: Please read FAQ before file an issue, see #2716

Description

The number of clients in the '/api/v1/streams' interface is incorrect.

  1. SRS Version: 4.0.251

  2. SRS Log:

[2023-04-28 16:00:11.099][Trace][37992][2189qbe0] complex handshake success.
[2023-04-28 16:00:11.099][Trace][37992][2189qbe0] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-04-28 16:00:11.140][Trace][37992][2189qbe0] connected, version=4.0.251.0, ip=192.168.26.42, pid=6828, id=0, dsu=1
[2023-04-28 16:00:11.140][Trace][37992][2189qbe0] edge-pull publish url rtmp://192.168.26.42:1936/live/2, stream=2 as 2
[2023-04-28 16:00:16.141][Warn][37992][2189qbe0][62] EdgeIngester: Ignore error, code=1011 : recv message : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : timeout 5000 ms
thread [37992][2189qbe0]: ingest() [src/app/srs_app_edge.cpp:320][errno=62]
thread [37992][2189qbe0]: recv_message() [src/protocol/srs_rtmp_stack.cpp:372][errno=62]
thread [37992][2189qbe0]: recv_interlaced_message() [src/protocol/srs_rtmp_stack.cpp:859][errno=62]
thread [37992][2189qbe0]: read_basic_header() [src/protocol/srs_rtmp_stack.cpp:954][errno=62]
thread [37992][2189qbe0]: grow() [src/protocol/srs_protocol_stream.cpp:162][errno=62]
thread [37992][2189qbe0]: read() [src/protocol/srs_service_st.cpp:507][errno=62]
[2023-04-28 16:00:19.145][Trace][37992][2189qbe0] complex handshake success.
[2023-04-28 16:00:19.145][Trace][37992][2189qbe0] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-04-28 16:00:19.186][Trace][37992][2189qbe0] connected, version=4.0.251.0, ip=192.168.26.42, pid=6828, id=0, dsu=1
[2023-04-28 16:00:19.187][Trace][37992][2189qbe0] edge-pull publish url rtmp://192.168.26.42:1936/live/2, stream=2 as 2
[2023-04-28 16:00:24.188][Warn][37992][2189qbe0][62] EdgeIngester: Ignore error, code=1011 : recv message : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : timeout 5000 ms
thread [37992][2189qbe0]: ingest() [src/app/srs_app_edge.cpp:320][errno=62]
thread [37992][2189qbe0]: recv_message() [src/protocol/srs_rtmp_stack.cpp:372][errno=62]
thread [37992][2189qbe0]: recv_interlaced_message() [src/protocol/srs_rtmp_stack.cpp:859][errno=62]
thread [37992][2189qbe0]: read_basic_header() [src/protocol/srs_rtmp_stack.cpp:954][errno=62]
thread [37992][2189qbe0]: grow() [src/protocol/srs_protocol_stream.cpp:162][errno=62]
thread [37992][2189qbe0]: read() [src/protocol/srs_service_st.cpp:507][errno=62]
[2023-04-28 16:00:27.191][Trace][37992][2189qbe0] complex handshake success.
[2023-04-28 16:00:27.191][Trace][37992][2189qbe0] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-04-28 16:00:27.233][Trace][37992][2189qbe0] connected, version=4.0.251.0, ip=192.168.26.42, pid=6828, id=0, dsu=1
[2023-04-28 16:00:27.233][Trace][37992][2189qbe0] edge-pull publish url rtmp://192.168.26.42:1936/live/2, stream=2 as 2
[2023-04-28 16:00:32.234][Warn][37992][2189qbe0][62] EdgeIngester: Ignore error, code=1011 : recv message : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : timeout 5000 ms
thread [37992][2189qbe0]: ingest() [src/app/srs_app_edge.cpp:320][errno=62]
thread [37992][2189qbe0]: recv_message() [src/protocol/srs_rtmp_stack.cpp:372][errno=62]
thread [37992][2189qbe0]: recv_interlaced_message() [src/protocol/srs_rtmp_stack.cpp:859][errno=62]
thread [37992][2189qbe0]: read_basic_header() [src/protocol/srs_rtmp_stack.cpp:954][errno=62]
thread [37992][2189qbe0]: grow() [src/protocol/srs_protocol_stream.cpp:162][errno=62]
thread [37992][2189qbe0]: read() [src/protocol/srs_service_st.cpp:507][errno=62]
[2023-04-28 16:00:35.237][Trace][37992][2189qbe0] complex handshake success.
[2023-04-28 16:00:35.237][Trace][37992][2189qbe0] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-04-28 16:00:35.278][Trace][37992][2189qbe0] connected, version=4.0.251.0, ip=192.168.26.42, pid=6828, id=0, dsu=1
[2023-04-28 16:00:35.278][Trace][37992][2189qbe0] edge-pull publish url rtmp://192.168.26.42:1936/live/2, stream=2 as 2
[2023-04-28 16:00:40.280][Warn][37992][2189qbe0][62] EdgeIngester: Ignore error, code=1011 : recv message : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : timeout 5000 ms
thread [37992][2189qbe0]: ingest() [src/app/srs_app_edge.cpp:320][errno=62]
thread [37992][2189qbe0]: recv_message() [src/protocol/srs_rtmp_stack.cpp:372][errno=62]
thread [37992][2189qbe0]: recv_interlaced_message() [src/protocol/srs_rtmp_stack.cpp:859][errno=62]
thread [37992][2189qbe0]: read_basic_header() [src/protocol/srs_rtmp_stack.cpp:954][errno=62]
thread [37992][2189qbe0]: grow() [src/protocol/srs_protocol_stream.cpp:162][errno=62]
thread [37992][2189qbe0]: read() [src/protocol/srs_service_st.cpp:507][errno=62]
[2023-04-28 16:00:43.294][Trace][37992][2189qbe0] complex handshake success.
[2023-04-28 16:00:43.295][Trace][37992][2189qbe0] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-04-28 16:00:43.343][Trace][37992][2189qbe0] connected, version=4.0.251.0, ip=192.168.26.42, pid=6828, id=0, dsu=1
[2023-04-28 16:00:43.345][Trace][37992][2189qbe0] edge-pull publish url rtmp://192.168.26.42:1936/live/2, stream=2 as 2
[2023-04-28 16:00:48.346][Warn][37992][2189qbe0][62] EdgeIngester: Ignore error, code=1011 : recv message : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : timeout 5000 ms
thread [37992][2189qbe0]: ingest() [src/app/srs_app_edge.cpp:320][errno=62]
thread [37992][2189qbe0]: recv_message() [src/protocol/srs_rtmp_stack.cpp:372][errno=62]
thread [37992][2189qbe0]: recv_interlaced_message() [src/protocol/srs_rtmp_stack.cpp:859][errno=62]
thread [37992][2189qbe0]: read_basic_header() [src/protocol/srs_rtmp_stack.cpp:954][errno=62]
thread [37992][2189qbe0]: grow() [src/protocol/srs_protocol_stream.cpp:162][errno=62]
thread [37992][2189qbe0]: read() [src/protocol/srs_service_st.cpp:507][errno=62]

[2023-04-28 16:00:52.372][Trace][37992][2e488867] RTMP client ip=192.168.26.164:34282, fd=18
[2023-04-28 16:00:52.381][Trace][37992][2e488867] simple handshake success.
[2023-04-28 16:00:52.383][Trace][37992][2e488867] connect app, tcUrl=rtmp://192.168.26.122:1935/live, pageUrl=, swfUrl=, schema=rtmp, vhost=192.168.26.122, port=1935, app=live, args=null
[2023-04-28 16:00:52.383][Trace][37992][2e488867] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-04-28 16:00:52.422][Trace][37992][2e488867] client identified, type=fmle-publish, vhost=192.168.26.122, app=live, stream=2, param=, duration=0ms
[2023-04-28 16:00:52.422][Trace][37992][2e488867] connected stream, tcUrl=rtmp://192.168.26.122:1935/live, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=live, stream=2, param=, args=null
[2023-04-28 16:00:52.422][Trace][37992][2e488867] source url=/live/2, ip=192.168.26.164, cache=1, is_edge=1, source_id=2189qbe0/1by498oh
[2023-04-28 16:00:52.462][Trace][37992][2e488867] edge change from 0 to state 200 (push).
[2023-04-28 16:00:52.465][Trace][37992][2e488867] complex handshake success.
[2023-04-28 16:00:52.465][Trace][37992][2e488867] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2023-04-28 16:00:52.506][Trace][37992][2e488867] connected, version=4.0.251.0, ip=192.168.26.42, pid=6828, id=0, dsu=1
[2023-04-28 16:00:52.506][Trace][37992][2e488867] edge-fwr publish url rtmp://192.168.26.42:1936/live/2, stream=2 as 2
[2023-04-28 16:00:52.507][Trace][37992][2e488867] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0

[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] HTTP #0 10.0.1.243:52697 GET http://192.168.26.31:8080/live/2.flv, content-length=-1
[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] flv: source url=/live/2, is_edge=1, source_id=/2189qbe0
[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] ignore disabled exec for vhost=__defaultVhost__
[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] dispatch cached gop success. count=0, duration=-1
[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] create consumer, active=1, queue_size=0.00, jitter=30000000
[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] set fd=17, SO_SNDBUF=46080=>175000, buffer=350ms
[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] FLV /live/2.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2023-04-28 16:01:03.820][Trace][37992][w3gis3u2] update source_id=w3gis3u2/2189qbe0

[2023-04-28 16:01:09.637][Trace][37992][w3gis3u2] cleanup when unpublish
[2023-04-28 16:01:09.637][Trace][37992][w3gis3u2] edge change from 101 to 300 then 0 (init).
[2023-04-28 16:01:09.637][Trace][37992][w3gis3u2] TCP: before dispose resource(HttpStream)(0x2e67dc0), conns=8, zombies=0, ign=0, inz=0, ind=0
[2023-04-28 16:01:09.637][Warn][37992][w3gis3u2][4] client disconnect peer. ret=1007
[2023-04-28 16:01:09.637][Trace][37992][w3gis3u2] TCP: disposing #0 resource(HttpStream)(0x2e67dc0), conns=8, disposing=1, zombies=0

[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] HTTP #0 10.0.1.243:52700 GET http://192.168.26.31:8080/live/2.flv, content-length=-1
[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] flv: source url=/live/2, is_edge=1, source_id=/289u3882
[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] ignore disabled exec for vhost=__defaultVhost__
[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] dispatch cached gop success. count=0, duration=-1
[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] create consumer, active=1, queue_size=0.00, jitter=30000000
[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] set fd=12, SO_SNDBUF=46080=>175000, buffer=350ms
[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] FLV /live/2.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2023-04-28 16:01:11.984][Trace][37992][81w3e01p] update source_id=81w3e01p/289u3882

[2023-04-28 16:02:17.452][Error][37992][2e488867][4] edge push get server control message failed. err=code=1007 : recv interlaced message : read basic header : basic header requires 1 bytes : read bytes : read
thread [37992][2e488867]: recv_message() [src/protocol/srs_rtmp_stack.cpp:372][errno=4]
thread [37992][2e488867]: recv_interlaced_message() [src/protocol/srs_rtmp_stack.cpp:859][errno=4]
thread [37992][2e488867]: read_basic_header() [src/protocol/srs_rtmp_stack.cpp:954][errno=4]
thread [37992][2e488867]: grow() [src/protocol/srs_protocol_stream.cpp:162][errno=4]
thread [37992][2e488867]: read() [src/protocol/srs_service_st.cpp:514][errno=4](Interrupted system call)
[2023-04-28 16:02:17.452][Trace][37992][2e488867] edge change from 200 to state 0 (init).
[2023-04-28 16:02:17.452][Trace][37992][2e488867] TCP: before dispose resource(RtmpConn)(0x3077060), conns=6, zombies=0, ign=0, inz=0, ind=0
[2023-04-28 16:02:17.452][Warn][37992][2e488867][104] client disconnect peer. ret=1007
[2023-04-28 16:02:17.452][Trace][37992][an053lsl] TCP: clear zombies=1 resources, conns=6, removing=0, unsubs=0
[2023-04-28 16:02:17.452][Trace][37992][2e488867] TCP: disposing #0 resource(RtmpConn)(0x3077060), conns=6, disposing=1, zombies=0

[2023-04-28 16:49:20.412][Trace][37992][aue06vr8] HTTP #0 192.168.26.125:56624 GET http://192.168.26.122:8080/live/2.flv, content-length=-1
[2023-04-28 16:49:20.412][Trace][37992][aue06vr8] dispatch cached gop success. count=141, duration=1959
[2023-04-28 16:49:20.412][Trace][37992][aue06vr8] create consumer, active=1, queue_size=0.00, jitter=30000000
[2023-04-28 16:49:20.412][Trace][37992][aue06vr8] set fd=15, SO_SNDBUF=87040=>175000, buffer=350ms
[2023-04-28 16:49:20.412][Trace][37992][aue06vr8] FLV /live/2.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2023-04-28 16:49:20.412][Trace][37992][aue06vr8] -> HTS http: got 128 msgs, age=0, min=8, mw=350
[2023-04-28 16:49:20.413][Trace][37992][aue06vr8] FLV: write header audio=1, video=1

[2023-04-28 16:49:28.876][Trace][37992][0fe0s4dw] HTTP #0 192.168.26.125:56639 GET http://192.168.26.122:8080/live/2.flv, content-length=-1
[2023-04-28 16:49:28.877][Trace][37992][0fe0s4dw] dispatch cached gop success. count=141, duration=1959
[2023-04-28 16:49:28.877][Trace][37992][0fe0s4dw] create consumer, active=1, queue_size=0.00, jitter=30000000
[2023-04-28 16:49:28.877][Trace][37992][0fe0s4dw] set fd=15, SO_SNDBUF=87040=>175000, buffer=350ms
[2023-04-28 16:49:28.877][Trace][37992][0fe0s4dw] FLV /live/2.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2023-04-28 16:49:28.877][Trace][37992][0fe0s4dw] FLV: write header audio=1, video=1

[2023-04-28 16:50:42.118][Trace][37992][0q27gt2h] HTTP #0 192.168.26.125:56672 GET http://192.168.26.122:8080/live/2.flv, content-length=-1
[2023-04-28 16:50:42.118][Trace][37992][0q27gt2h] dispatch cached gop success. count=141, duration=1959
[2023-04-28 16:50:42.118][Trace][37992][0q27gt2h] create consumer, active=1, queue_size=0.00, jitter=30000000
[2023-04-28 16:50:42.118][Trace][37992][0q27gt2h] set fd=18, SO_SNDBUF=87040=>175000, buffer=350ms
[2023-04-28 16:50:42.118][Trace][37992][0q27gt2h] FLV /live/2.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2023-04-28 16:50:42.118][Trace][37992][0q27gt2h] -> HTS http: got 128 msgs, age=0, min=8, mw=350
[2023-04-28 16:50:42.119][Trace][37992][0q27gt2h] FLV: write header audio=1, video=1
  1. SRS Config:
Edge node 1:
# the config for srs to remux rtmp to flv live stream.
# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
pid                 srs.flv.1935.pid;
daemon              on;
srs_log_tank        file;
srs_log_file        srs.log;
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

http_api{
        enabled     on;
        listen      1985;
}

vhost __defaultVhost__ {
    cluster {
        mode remote;
        origin 192.168.26.42:1936;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    play {
        time_jitter full;
        mix_correct on;
    }
}
Edge node 2:
# the config for srs to remux rtmp to flv live stream.
# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
pid                 srs.flv.1935.pid;
daemon              on;
srs_log_tank        file;
srs_log_file        srs.log;
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

http_api{
        enabled     on;
        listen      1985;
}

vhost __defaultVhost__ {
    cluster {
        mode remote;
        origin 192.168.26.42:1936;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    play {
        time_jitter full;
        mix_correct on;
    }
}
Core node:
# the config for srs to remux rtmp to flv live stream.
# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream
# @see full.conf for detail config.

listen              1936;
max_connections     1000;
daemon              on;
srs_log_tank        file;
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

http_api{
        enabled     on;
        listen      1985;
}

vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    play {
        time_jitter full;
        mix_correct on;
    }
}

Replay

The streaming address in the log is (http://192.168.26.31:8080/live/2.flv); the above log is for edge node 1, according to the SRS log, the basic process is as follows:

Step 1: The client pulls the stream from edge node 1.

Step 2: Call the /api/v1/streams interface of edge node 1 and edge node 2 separately (16:00:47.426) Edge node 1: { "code": 0, "server": "vid-6565k44", "streams": [{ "id": "vid-081733f", "name": "3", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668847408, "clients": 0, "frames": 1149, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }, { "id": "vid-31re7qf", "name": "2", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668847408, "clients": 1, "frames": 0, "send_bytes": 13156322, "recv_bytes": 360, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": true, "cid": "746uwkxf" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }, { "id": "vid-3bdps75", "name": "5", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668847408, "clients": 1, "frames": 0, "send_bytes": 441128, "recv_bytes": 360, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": true, "cid": "n2k32338" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }, { "id": "vid-i5b4045", "name": "11", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668847408, "clients": 0, "frames": 2185, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }, { "id": "vid-l40l38d", "name": "4", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668847408, "clients": 2, "frames": 1020, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": true, "cid": "z9o1288h" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }] } Edge node 2: { "code": 0, "server": "vid-6s6p9o9", "streams": [{ "id": "vid-025v181", "name": "3", "vhost": "vid-44mkq32", "app": "live", "live_ms": 1682668847395, "clients": 1, "frames": 0, "send_bytes": 9738359, "recv_bytes": 360, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": true, "cid": "8t40l827" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }, { "id": "vid-1f737zo", "name": "5", "vhost": "vid-44mkq32", "app": "live", "live_ms": 1682668847395, "clients": 2, "frames": 171918, "send_bytes": 1709871839, "recv_bytes": 1452830413, "kbps": { "recv_30s": 1832, "send_30s": 3729 }, "publish": { "active": true, "cid": "94l4s062" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }, { "id": "vid-69920hv", "name": "4", "vhost": "vid-44mkq32", "app": "live", "live_ms": 1682668847395, "clients": 1, "frames": 0, "send_bytes": 14294130, "recv_bytes": 360, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": true, "cid": "o13t06kh" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }, { "id": "vid-77q359k", "name": "2", "vhost": "vid-44mkq32", "app": "live", "live_ms": 1682668847395, "clients": 0, "frames": 1821, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }] }

Step 3: Start streaming (corresponding to the log at 16:00:52.372)

Step 4: Client pulls the stream (corresponding to the log at 16:01:03.820) ps: At this time, the client is the same as the one in Step 1 (reconnected) Step 5: Client stream disconnection (corresponding to the log at 16:01:09.637)

Step 6: Client pulls the stream (corresponding to the log at 16:01:11.984) ps: At this time, the client is the same as the one in Step 4 (reconnected) Step 7: Call the /api/v1/streams interface of edge node 1 and edge node 2 respectively (16:01:18.420) Edge node 1: { "code": 0, "server": "vid-6565k44", "streams": [{ "id": "vid-5258f20", "name": "2", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668878391, "clients": 1, "frames": 670, "send_bytes": 1754798, "recv_bytes": 360, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": true, "cid": "81w3e01p" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }, { "id": "vid-537fz8o", "name": "6", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668878391, "clients": 0, "frames": 916, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }, { "id": "vid-g7l51sn", "name": "3", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668878391, "clients": 0, "frames": 128, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }, { "id": "vid-i5b4045", "name": "11", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668878391, "clients": 0, "frames": 2185, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }, { "id": "vid-v21yy65", "name": "4", "vhost": "vid-95llyg7", "app": "live", "live_ms": 1682668878391, "clients": 0, "frames": 792, "send_bytes": 0, "recv_bytes": 0, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }] } Edge node 2: { "code": 0, "server": "vid-6s6p9o9", "streams": [{ "id": "vid-1f737zo", "name": "5", "vhost": "vid-44mkq32", "app": "live", "live_ms": 1682668878393, "clients": 2, "frames": 172810, "send_bytes": 1718685902, "recv_bytes": 1461815832, "kbps": { "recv_30s": 1858, "send_30s": 2078 }, "publish": { "active": true, "cid": "94l4s062" }, "video": { "codec": "H264", "profile": "High", "level": "Other", "width": 128, "height": 2144 }, "audio": { "codec": "AAC", "sample_rate": 44100, "channel": 2, "profile": "LC" } }, { "id": "vid-b2x7417", "name": "1", "vhost": "vid-44mkq32", "app": "live", "live_ms": 1682668878393, "clients": 1, "frames": 537, "send_bytes": 4050, "recv_bytes": 5455822, "kbps": { "recv_30s": 0, "send_30s": 0 }, "publish": { "active": false, "cid": "" }, "video": null, "audio": null }] }

Step 8: Stop streaming (corresponding to the log at 16:02:17.452)

Expect

In Step 7, the "clients" field of the edge node 1, which has the "name": "2", should be 2 (streaming clients and playback clients); this issue occasionally occurs.

There is another step where the inaccurate "clients" field always appears, but it is uncertain if it is the same issue:

Step 1: Choose any edge node for streaming. Step 2: Fetch the streaming video. Step 3: Call the /api/v1/streams endpoint, at this point the "clients" field is 2. Step 4: Stop the playback. Step 5: Call the /api/v1/streams endpoint, at this point the "clients" field is 0 (it should be 2-1=1).

TRANS_BY_GPT3

songxian43 commented 1 year ago

Tried version 5.0.152 and this issue is not present. Closing the problem submission.

TRANS_BY_GPT3