pingostack / pingos

Based on the NGINX/RTMP/HTTP-FLV/HTTP-TS/HLS/HLS+/DASH/H.264/H.265/AAC/MP3/Live/Record/VOD/Push/Pull/Multiple Processes/Dynamic Configuration/Configuration Variables/Console Interface/Notify
https://pingos.io
BSD 3-Clause "New" or "Revised" License
987 stars 273 forks source link

客户端拉取hls2流100% crash #104

Open lystormenvoy opened 1 year ago

lystormenvoy commented 1 year ago

image

image

lystormenvoy commented 1 year ago

两个hls2的location

location ^~ /media-server/hls2 {
                include conf.d/hlsplus_rewrite.conf;
                include conf.d/options.conf;
                error_log logs/live_error.log warn;
                access_log  logs/live_hlsplus_access_$logDate.log;
                hls2_live 1935 app=hls;
                add_header 'Access-Control-Allow-Origin' '*';
        }
location /hls2 {
                include conf.d/options.conf;
                access_log  logs/live_hlsplus_access_$logDate.log;
                hls2_live 1935 app=hls;
                add_header 'Access-Control-Allow-Origin' '*';
        }

hlsplus_rewrite.conf内容:

 #设置这个变量为有location和协议参数的,这个就避免hls+里主m3u8返回的m3u8地址不对
                        set $hls_args location=/media-server&scheme=$scheme;
                        #默认要重写
                        set $rewrite 1;
                        if ($args) {
                                #如果已经有参数了,就不需要重写了
                                set $rewrite 0;
                                set $hls_args $args&location=/media-server&scheme=$scheme;
                        }
                        if ($rewrite = 1) {
                                rewrite ^/(.*)/(.*)\.(.*)$ $scheme://$host:$server_port/media-server/hls2/$2.$3?$hls_args break;
                        }

crash的是访问media-server格式的m3u8会crash

491行代码应该是:

 cscf = addr_conf->default_server->ctx->
            srv_conf[ngx_rtmp_core_module.ctx_index];

image

拉流location /hls2 无法拉流,提示410 Gone,相关日志打印:

2023/02/08 12:18:29 [info] 28151#28151: *107 hls-http: close| finalize http request, client: 192.168.19.161, server: _, request: "GET /hls2/ll_ch1_s1.m3u8?session=1675829825t-0i-0p-101c HTTP/1.1", host: "192.168.36.70:80"
2023/02/08 12:18:29 [info] 28151#28151: *107 client 192.168.19.161 closed keepalive connection (104: Connection reset by peer)
2023/02/08 12:18:29 [error] 28151#28151: *109 hls-http: m3u8_handler| hls session 1675829825t-0i-0p-101c not found, client: 192.168.19.161, server: _, request: "GET /hls2/ll_ch1_s1.m3u8?session=1675829825t-0i-0p-101c HTTP/1.0", host: "192.168.36.70"