When switching live streams, the edge server encounters an error while retrieving the source_url.
HunterTang opened this issue · comments
Describe the bug
When I perform some transcoding on the origin using ffmpeg (exec), then locally forward it to the SRS's 1945 port as the origin, with an edge server configured in remote mode, when I attempt to switch live streams on the edge server (these live streams have similar names like AAA_BBB_id_CCC), the switch is not successful. It always sticks to the first stream. This issue exists in version 5.0 but not in version 4.0, and even if version 4.0 is used as the origin, the issue persists with version 5.0 on the edge server.
Version
5.0_b1(has bug)
5.0_r1(has bug)
4.0_r4(ok)
4.0_r1(ok)
Conf
# origin - ffmpeg
application imlive {
live on;
exec_push ffmpeg -i rtmp://localhost/imlive/$name -ar 22050 -c:a libmp3lame -f flv rtmp://localhost:1945/imlive/$name;
}
# origin-srs
listen 1945;
max_connections 10000;
pid /mnt/srs/srs.pid;
srs_log_tank file;
srs_log_file /mnt/srs/log/srs.log;
daemon on;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir /usr/local/srs/objs/nginx/html;
}
vhost __defaultVhost__ {
cluster {
mode local;
origin_cluster on;
coworkers 172.17.201.217:1985;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
# edge-srs
listen 1945;
max_connections 10000;
pid /mnt/srs/srs.pid;
srs_log_tank file;
srs_log_file /mnt/srs/log/srs.log;
daemon on;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
crossdomain off;
dir /usr/local/srs/objs/nginx/html;
}
vhost __defaultVhost__ {
cluster {
mode remote;
origin 172.17.245.180:1945 172.17.201.217:1945;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
Additional context
summary
# 5.0
source url=/imlive/WavMain, is_edge=1, source_id=7403554d/8xjj8788
# 4.0
flv: source url=/imlive/WavMain.exe_rooms_290_20240402, is_edge=1, source_id=/es59rq63
5.0
[2024-04-02 19:43:05.844][INFO][29621][e47c405x] HTTP #0 127.0.0.1:27410 GET http://xxxxxx/imlive/WavMain.exe_rooms_290_20240402.flv, content-length=-1
[2024-04-02 19:43:05.844][INFO][29621][e47c405x] flv: source url=/imlive/WavMain, is_edge=1, source_id=7403554d/8xjj8788
[2024-04-02 19:43:05.844][INFO][29621][e47c405x] flv: source url=/imlive/WavMain, is_edge=1, source_id=7403554d/8xjj8788
...
[2024-04-02 19:43:24.223][INFO][29621][5184170j] HTTP #0 127.0.0.1:27416 GET http://xxxxxx/imlive/WavMain.exe_rooms_311_20240402.flv, content-length=-1
[2024-04-02 19:43:24.223][INFO][29621][5184170j] flv: source url=/imlive/WavMain, is_edge=1, source_id=7403554d/8xjj8788
[2024-04-02 19:43:24.223][INFO][29621][5184170j] flv: source url=/imlive/WavMain, is_edge=1, source_id=7403554d/8xjj8788
...
[2024-04-02 19:43:46.255][INFO][29621][w0597f2j] HTTP #0 127.0.0.1:27424 GET http://xxxxxx/imlive/WavMain.exe_rooms_222_20240402.flv, content-length=-1
[2024-04-02 19:43:46.255][INFO][29621][w0597f2j] flv: source url=/imlive/WavMain, is_edge=1, source_id=7403554d/8xjj8788
[2024-04-02 19:43:46.255][INFO][29621][w0597f2j] flv: source url=/imlive/WavMain, is_edge=1, source_id=7403554d/8xjj8788
4.0
[2024-04-02 19:45:34.395][Trace][30211][56w455dt] HTTP #0 127.0.0.1:27468 GET http://fxxxxxx/imlive/WavMain.exe_rooms_282_20240402.flv, content-length=-1
[2024-04-02 19:45:34.395][Trace][30211][56w455dt] new source, stream_url=/imlive/WavMain.exe_rooms_282_20240402
[2024-04-02 19:46:05.834][Trace][30211][11916v31] HTTP #0 127.0.0.1:27500 GET http://xxxxxx/WavMain.exe_rooms_290_20240402.flv, content-length=-1
[2024-04-02 19:46:05.834][Trace][30211][11916v31] FLV /imlive/WavMain.exe_rooms_290_20240402.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2024-04-02 19:46:11.115][Trace][30211][za6t6937] HTTP #0 127.0.0.1:27502 GET http://xxxxxx/imlive/WavMain.exe_rooms_290_20240402.flv, content-length=-1
[2024-04-02 19:46:11.115][Trace][30211][za6t6937] flv: source url=/imlive/WavMain.exe_rooms_290_20240402, is_edge=1, source_id=/es59rq63
[2024-04-02 19:46:11.115][Trace][30211][za6t6937] FLV /imlive/WavMain.exe_rooms_290_20240402.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2024-04-02 19:46:11.115][Trace][30211][za6t6937] update source_id=za6t6937/es59rq63
[2024-04-02 19:46:14.337][Trace][30211][1alr0394] HTTP #0 127.0.0.1:27508 GET http://xxxxxx/imlive/WavMain.exe_rooms_282_20240402.flv, content-length=-1
[2024-04-02 19:46:14.337][Trace][30211][1alr0394] flv: source url=/imlive/WavMain.exe_rooms_282_20240402, is_edge=1, source_id=/37y12141
[2024-04-02 19:46:14.337][Trace][30211][1alr0394] FLV /imlive/WavMain.exe_rooms_282_20240402.flv, encoder=FLV, nodelay=0, mw_sleep=350ms, cache=0, msgs=128
[2024-04-02 19:46:14.337][Trace][30211][1alr0394] update source_id=1alr0394/37y12141
Sorry, you only describe the final states and logs, how to reproduce it step by step? There should be a reproduce step that is to describe the steps.
@winlinvip Sorry for forgetting to add the steps
steps
test according to the following topology:
origin: 172.17.245.180 - edge: 172.17.245.182
Here are some issues with the origin:
- I used nginx_rtmp (exec ffmpeg) on the origin to convert the same stream into 3 different streams as shown below.
ffmpeg -i rtmp://localhost/imlive/WavMain.exe_rooms_282_20240403 -ar 22050 -c:a libmp3lame -f flv rtmp://localhost:1945/imlive/WavMain.exe_rooms_282_20240403
ffmpeg -i rtmp://localhost/imlive/WavMain.exe_rooms_282_20240403 -ar 22050 -c:a libmp3lame -f flv rtmp://localhost:1945/imlive/WavMain.exe_rooms_283_20240403
ffmpeg -i rtmp://localhost/imlive/WavMain.exe_rooms_282_20240403 -ar 22050 -c:a libmp3lame -f flv rtmp://localhost:1945/imlive/WavMain.exe_rooms_284_20240403
It seems that SRS 5.0 only recognizes one of the streams.
Here are some issues with the edge:
Considering the incomplete stream recognition on the origin with SRS 5.0, I switched the origin to 4.0 and then started testing the edge with 5.0.
-
When I pull the following 3 streams separately via flv, I see the following on the console.
-
I saw the switch records in the log as follows.
[2024-04-03 13:17:54.393][INFO][21177][348dms90] HTTP #0 10.202.100.189:58167 GET http://172.17.245.182:8080/imlive/WavMain.exe_rooms_283_20240403.flv, content-length=-1
[2024-04-03 13:17:54.393][INFO][21177][348dms90] flv: source url=/imlive/WavMain, is_edge=1, source_id=vb84bv6q/9jnmn8eg
[2024-04-03 13:17:54.393][INFO][21177][348dms90] flv: source url=/imlive/WavMain, is_edge=1, source_id=vb84bv6q/9jnmn8eg
[2024-04-03 13:18:10.050][INFO][21177][8545n554] HTTP #0 10.202.100.189:58176 GET http://172.17.245.182:8080/imlive/WavMain.exe_rooms_284_20240403.flv, content-length=-1
[2024-04-03 13:18:10.050][INFO][21177][8545n554] flv: source url=/imlive/WavMain, is_edge=1, source_id=vb84bv6q/9jnmn8eg
[2024-04-03 13:18:10.051][INFO][21177][8545n554] flv: source url=/imlive/WavMain, is_edge=1, source_id=vb84bv6q/9jnmn8eg