INFO: [0x7f18100020d0]CSLSRole::get_state, check_idle_streams_duration is true, cur m_state=1, m_idle_streams_timeout=10s, call invalid_srt.
INFO: [0x7f18100020d0]CSLSRole::invalid_srt, close sock=992137676, m_state=2.
INFO: [0x7f1810000be0]CSLSSrt::libsrt_close, fd=992137676.
INFO: [0x11305f0]CSLSGroup::check_invalid_sock, worker_number=0, publisher=0x7f18100020d0, invalid sock=0, state=2, role_map.size=2.
INFO: [0x1117b18]CSLSMapData::remove, key=‘uplive.sls.com/live/test’ delete array_data=0x7f1810000a90.
INFO: [0x7f18100020d0]CSLSPublisher::uninit, removed publisher from m_map_data, ret=0.
INFO: [0x1117bd8]CSLSMapPublisher::remove, publisher=0x7f18100020d0, live_key=uplive.sls.com/live/test.
INFO: [0x7f18100020d0]CSLSPublisher::uninit, removed publisher from m_map_publisher, ret=0.
INFO: [0x11305f0]CSLSGroup::check_invalid_sock, worker_number=0, publisher=0x7f18100020d0, delete.
先说下环境,笔者处理器为Intel® Core™ i5-6300U CPU @2.40GHz。
srt推流,当推流端帧率过大,推流时,计算机性能跟不上,开始丢帧,就会出现这个错误,建立连接后,sls默认10s中没有接收到有效的数据信息,就认为这是个无效的连接会自动把它清楚delete。
打开sls的配置文件srt-live-server/sls.conf,把其中的idle_streams_timeout由10s,改为30s,测试通过。
配置文件如下:
srt {
#SRT
worker_threads 1;
worker_connections 300 ;
log_file logs/error.log ;
log_level info;
#stat_post_url http://192.168.31.106:8001/sls/stat;
#stat_post_interval 5;#s
record_hls_path_prefix /tmp/mov/sls;
#vod file name: /tmp/mov/sls/$listen/$domain_publisher/$app_publisher/$stream_name/vod.m3u8
server {
listen 8080;
latency 20; #ms
domain_player live.sls.com live-1.sls.com;
domain_publisher uplive.sls.com;
backlog 100; #accept connections at the same time
idle_streams_timeout 30;#s -1: unlimited #10s改为30秒
#on_event_url http://192.168.31.106:8000/sls/on_event; #?method=on_connect|on_close&role_name=&srt_url=%s
app {
app_player live ;
app_publisher live ;
record_hls off;#on, off
record_hls_segment_duration 10; #unit s
#relay {
# type pull;
# mode loop;#loop; hash;
# reconnect_interval 10;
# idle_streams_timeout -1;#s -1: unlimited
# upstreams 127.0.0.1:9090?streamid=live.sls.com/live 192.168.1.100:8080/?streamid=live.test.com/live;
#}
#relay {
# type push;
# mode all; #all; hash
# reconnect_interval 10;
# idle_streams_timeout 30;#s -1: unlimited
# upstreams 192.168.31.106:8080?streamid=uplive.sls.com/live ;
#}
}
}
}