Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: There is an issue with the request parameters in the on_hls callback of the HLS protocol. #2485

Closed
dongrixinyu opened this issue Jul 23, 2021 · 0 comments · Fixed by #2549
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@dongrixinyu
Copy link

dongrixinyu commented Jul 23, 2021

Description'

Please ensure that the markdown structure is maintained.

Please describe the issue you encountered here.
'
Make sure to maintain the markdown structure.

  1. SRS version: 4.0.123, 4.0.136 docker
  2. The logs of SRS are as follows:
[2021-07-23 13:58:00.885][Trace][1][3703wn77] start publish mr=0/100, p1stpt=20000, pnt=5000, tcp_nodelay=1
[2021-07-23 13:58:00.886][Trace][1][3703wn77] got metadata, width=1024, height=576, vcodec=7, acodec=10
[2021-07-23 13:58:00.886][Trace][1][3703wn77] 54B video sh,  codec(7, profile=Main, level=3.1, 1024x576, 0kbps, 0.0fps, 0.0s)
[2021-07-23 13:58:00.886][Trace][1][3703wn77] 4B audio sh, codec(10, profile=LC, 2channels, 0kbps, 48000HZ), flv(16bits, 2channels, 44100HZ)
[2021-07-23 13:58:00.886][Trace][1][3703wn77] -> HLS time=1413851497ms, sno=78, ts=http://127.0.0.1/.m3u8_dir/vehicle_detection/root/srs_ts_video_records/vehicle_detection/DEV00000004-3bc688cf/2021.07.23/1627019880885-[duration].ts, dur=0.00, dva=0p
[2021-07-23 13:58:00.978][Trace][1][0l386s6t] Hybrid cpu=0.00%,18MB, cid=1,0, timer=63,0,0, clock=0,49,1,0,0,0,0,0,0
[2021-07-23 13:58:05.978][Trace][1][0l386s6t] Hybrid cpu=2.00%,18MB, cid=2,1, timer=63,0,0, clock=0,48,1,0,0,0,0,0,0, objs=(pkt:94,raw:34,fua:59,msg:194,oth:1,buf:22)
[2021-07-23 13:58:10.979][Trace][1][0l386s6t] Hybrid cpu=2.00%,18MB, cid=2,1, timer=63,0,0, clock=0,48,1,0,0,0,0,0,0, objs=(pkt:94,raw:34,fua:59,msg:194,oth:1,buf:22)
[2021-07-23 13:58:15.979][Trace][1][0l386s6t] Hybrid cpu=3.00%,18MB, cid=1,0, timer=62,0,0, clock=0,46,2,0,0,0,0,0,0, objs=(pkt:272,raw:75,fua:196,msg:489,oth:1,buf:50)
[2021-07-23 13:58:19.106][Warn][1][3703wn77][11] ignore task failed code=3064 : callback on_hls http://192.168.11.137:2
kt:272,raw:75,fua:196,msg:489,oth:1,buf:50)
[2021-07-23 13:58:22.384][Trace][1][3703wn77] cleanup when unpublish
[2021-07-23 13:58:22.384][Trace][1][3703wn77] cleanup when unpublish, created=1, deliver=1
[2021-07-23 13:58:22.389][Trace][1][3703wn77] http: on_unpublish ok, client_id=3703wn77, url=http://192.168.11.137:29999/video_stream/on_unpublish, request={"action":"on_unpublish","client_id":"3703wn77","ip":"192.168.35.51","vhost":"__defaultVhost__","app":"vehicle_detection","stream":"DEV00000004-3bc688cf","param":"?token=3bc688cfcd6bf61a1759d2ec8b8f5338"}, response=0
[2021-07-23 13:58:22.389][Trace][1][3703wn77] TCP: before dispose resource(RtmpConn)(0x2244740), conns=1, zombies=0, ign=0, inz=0, ind=0
[2021-07-23 13:58:22.389][Warn][1][3703wn77][32] client disconnect peer. ret=1009
[2021-07-23 13:58:22.389][Trace][1][1642u67d] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0
[2021-07-23 13:58:22.389][Trace][1][3703wn77] TCP: disposing #0 resource(RtmpConn)(0x2244740), conns=1, disposing=1, zombies=0
[2021-07-23 13:58:25.980][Trace][1][0l386s6t] Hybrid cpu=0.00%,18MB, cid=1,0, timer=62,0,0, clock=0,46,2,0,0,0,0,0,0, objs=(pkt:272,raw:75,fua:196,msg:489,oth:1,buf:50)
  1. The configuration of SRS is as follows:
listen              1935;
max_connections     1000;
daemon              on;
srs_log_tank        file;
srs_log_file        /home/srs/srs.log;

http_api {
    enabled         on;
    listen          1985;
    crossdomain     on;
}

http_server {
    enabled         on;
    listen          20080;
    crossdomain     on;
    dir             ./objs/nginx/html;
}

rtc_server {
    enabled         on;
    listen          20090;
    candidate       $CANDIDATE;
}
vhost __defaultVhost__ {
    rtc {
        enabled         on;
        bframe          discard;
    }
    tcp_nodelay         on;
    min_latency         on;
    play {
        gop_cache       off;
        queue_length    3;   
        mw_latency      100;
    }
    publish {
        mr off;
        mr_latency  100;  
    }
    
    http_hooks {
        enabled         on;
        on_publish      http://192.168.11.137:29999/video_stream/on_publish;
        on_play         http://192.168.11.137:29999/video_stream/on_play;
        on_unpublish    http://192.168.11.137:29999/video_stream/on_unpublish;
        on_hls          http://192.168.11.137:29999/video_stream/on_hls;
    }
    
    http_remux {
        enabled         on;
        mount           [vhost]/[app]/[stream].flv;
        hstrs           on;
    }

    dvr {
        enabled         on;
        dvr_apply       all;
        dvr_plan        session;
        dvr_path        /root/srs_dvr_video_records/[app]/[stream]/[2006].[01].[02].[15].[04].[05].[999]-[duration].mp4;
        dvr_wait_keyframe       on;
        time_jitter             full;
        
    }
    
    hls {
        enabled                 on;
        hls_fragment            10;
        hls_td_ratio            1.5;
        hls_aof_ratio           2.0;
        hls_window              60;
        hls_on_error            continue;
        hls_path                /root/srs_ts_video_records;
        hls_m3u8_file           .m3u8_dir/[app]/[stream].m3u8;
        hls_ts_file             [app]/[stream]/[2006].[01].[02]/[timestamp]-[duration].ts;
        hls_ts_floor            off;
        hls_entry_prefix        http://192.168.11.137:29999;
        hls_acodec              aac;
        hls_vcodec              h264;
        hls_cleanup             off;
        hls_dispose             0;
        hls_nb_notify           64;
        hls_wait_keyframe       on;
        hls_keys                off; 
        hls_fragments_per_key   1;
        hls_dts_directly        on;
    }
}

Replay

How to replay bug?

Steps to reproduce the bug

Steps to replay the bug:

  1. Start the srs application.
  2. Start the on_hls service for processing.
  3. Check the request parameters for on_hls and observe that the duration in the file parameter is not replaced with the corresponding duration. In the example above, the saved file name is actually 1627019880885-19989.ts.
{'action': 'on_hls', 
'client_id': '3703wn77',
 'ip': '192.168.35.51',
 'vhost': '__defaultVhost__',
 'app': 'vehicle_detection',
 'stream': 'DEV00000004-3bc688cf',
 'param': '?token=3bc688cfcd6bf61a1759d2ec8b8f5338',
 'duration': 19.99,
 'cwd': '/usr/local/srs',
 'file': '/root/srs_ts_video_records/vehicle_detection/DEV00000004-3bc688cf/2021.07.23/1627019880885-[duration].ts',
 'url': 'http://127.0.0.1/.m3u8_dir/vehicle_detection/root/srs_ts_video_records/vehicle_detection/DEV00000004-3bc688cf/2021.07.23/1627019880885-[duration].ts',
 'm3u8': '/root/srs_ts_video_records/.m3u8_dir/vehicle_detection/DEV00000004-3bc688cf.m3u8',
 'm3u8_url': '.m3u8_dir/vehicle_detection/DEV00000004-3bc688cf.m3u8',
 'seq_no': 77}

Expected Behavior:

Ensure that the markdown structure is maintained.

1627019880885-[duration].ts is replaced with the actual duration. 1627019880885-19989.ts

TRANS_BY_GPT3

@dongrixinyu dongrixinyu changed the title HLS协议的 on_hls 回调,请求参数存在问题 HLS协议的 on_hls 回调,请求参数存在问题【BUG】 Jul 26, 2021
@dongrixinyu dongrixinyu changed the title HLS协议的 on_hls 回调,请求参数存在问题【BUG】 HLS协议的 on_hls 回调,请求参数存在问题 Jul 26, 2021
@winlinvip winlinvip changed the title HLS协议的 on_hls 回调,请求参数存在问题 API: HLS协议的 on_hls 回调,请求参数存在问题 Aug 18, 2021
@duiniuluantanqin duiniuluantanqin linked a pull request Aug 24, 2021 that will close this issue
@winlinvip winlinvip added the Bug It might be a bug. label Aug 25, 2021
@winlinvip winlinvip added this to the SRS 4.0 release milestone Aug 25, 2021
@winlinvip winlinvip changed the title API: HLS协议的 on_hls 回调,请求参数存在问题 API: There is an issue with the request parameters in the on_hls callback of the HLS protocol. Jul 29, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants