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.76k stars 5.39k forks source link

API: When callback, the push streaming parameters are lost. #2032

Closed flhcd closed 3 years ago

flhcd commented 4 years ago

Description Client streaming failed.

Description of the problem encountered: The streaming address of the streaming device used by the marathon organizer is rtmp://drs.live.yatv.tv:1935/live/live120842?9dFCBh. When SRS (Streaming Relay Server) receives the client identified as type=fmle-publish, it is able to parse the address parameters, but the connection is disconnected after approximately 1-2 seconds. However, when SRS receives the client identified as type=haivision-publish, it is unable to parse the address parameters, resulting in a failure of the on_publish HTTP callback. During streaming, there is a 50% chance that the type is parsed as haivision-publish with empty parameters.

1. SRS version: 3.0.145 1. SRS log: Please provide the log for further analysis.

[2020-11-13 09:04:54.294][Trace][103491][528823] RTMP client ip=172.10.13.186, fd=58
[2020-11-13 09:04:54.342][Trace][103491][528823] complex handshake success
[2020-11-13 09:04:54.382][Warn][103491][528823][11] drop the args, see: '4.1.1. connect', marker=0x2
[2020-11-13 09:04:54.382][Trace][103491][528823] connect app, tcUrl=rtmp://drs.live.yatv.tv/live, pageUrl=app://flash.swf, swfUrl=app://flash.swf, schema=rtmp, vhost=drs.live.yatv.tv, port=1935, app=live, args=null
[2020-11-13 09:04:54.382][Trace][103491][528823] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2020-11-13 09:04:54.684][Trace][103491][528823] client identified, type=haivision-publish, vhost=drs.live.yatv.tv, app=live, stream=live120842, param=?, duration=0ms
[2020-11-13 09:04:54.685][Trace][103491][528823] connected stream, tcUrl=rtmp://drs.live.yatv.tv/live, pageUrl=app://flash.swf, swfUrl=app://flash.swf, schema=rtmp, vhost=drs.live.yatv.tv, port=1935, app=live, stream=live120842, param=?, args=null
[2020-11-13 09:04:54.685][Trace][103491][528823] source url=drs.live.yatv.tv/live/live120842, ip=172.10.13.186, cache=1, is_edge=0, source_id=-1[-1]
[2020-11-13 09:04:54.712][Error][103491][528823][0] serve error code=3064 : service cycle : rtmp: stream service : rtmp: callback on publish : rtmp on_publish http://127.0.0.1:8880/api/on_publish : http: on_publish failed, client_id=528823, url=http://127.0.0.1:8880/api/on_publish, request={"action":"on_publish","client_id":528823,"ip":"172.10.13.186","vhost":"drs.live.yatv.tv","app":"live","tcUrl":"rtmp://drs.live.yatv.tv/live","stream":"live120842","param":"?"}, response={
   "code" : -1,
   "data" : "show is not found"
}
, code=200 : http: response object code -1 {
   "code" : -1,
   "data" : "show is not found"
}

thread [103491][528823]: do_cycle() [src/app/srs_app_rtmp_conn.cpp:210][errno=0]
thread [103491][528823]: service_cycle() [src/app/srs_app_rtmp_conn.cpp:399][errno=0]
thread [103491][528823]: publishing() [src/app/srs_app_rtmp_conn.cpp:818][errno=0]
thread [103491][528823]: http_hooks_on_publish() [src/app/srs_app_rtmp_conn.cpp:1307][errno=0]
thread [103491][528823]: on_publish() [src/app/srs_app_http_hooks.cpp:153][errno=0]
thread [103491][528823]: do_post() [src/app/srs_app_http_hooks.cpp:535][errno=0]

1. SRS configuration: Please provide the configuration details for further analysis.

# main config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
srs_log_tank        file;
srs_log_file        ./log/srs.log;
pid                 ./pid/srs.pid;

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

http_server {
    enabled         on; 
    listen          8080;
    crossdomain     on;
}

vhost drs.live.yatv.tv {
     http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    dvr {
        enabled             off; 
    }

    hls {
        enabled         on;
        hls_fragment    5;
        hls_window      50;
        hls_path        ./media;
        hls_m3u8_file   data/[app]/[stream]/playlist.m3u8;
        hls_ts_file     data/[app]/[stream]/seg/Num[seq].ts;

    }

    http_hooks {
        enabled         on;
        on_publish      http://127.0.0.1:8880/api/on_publish;
        on_unpublish    http://127.0.0.1:8880/api/on_unpublish;
        on_hls          http://127.0.0.1:8880/api/on_hls; 
    }
}

vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    hls {
        enabled         on;
        hls_fragment    5;
        hls_window      100;
        hls_path        ./media;
        hls_m3u8_file   data/[app]/[stream]/playlist.m3u8;
        hls_ts_file     data/[app]/[stream]/seg/Num[seq].ts;
    }

    http_hooks {
        enabled         on;
        on_publish      http://127.0.0.1:7999/api/on_publish;
        on_unpublish    http://127.0.0.1:7999/api/on_unpublish;
        on_hls          http://127.0.0.1:7999/api/on_hls; 
    }
}

Replay: As long as the marathon organizer's streaming device is broadcasting, it can be replayed.

Expect: The expectation is to be able to receive the stream from the device and be able to recognize the streaming address parameters.

TRANS_BY_GPT3

winlinvip commented 3 years ago

This needs to be checked.

TRANS_BY_GPT3

liyoung1992 commented 3 years ago

I also encountered a similar problem. rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470&Time=1629800410 becomes rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470

TRANS_BY_GPT3

duiniuluantanqin commented 3 years ago

I also encountered a similar problem. rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470&Time=1629800410 It becomes rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470

I tested it and couldn't reproduce the issue. Please try using the latest version. If the problem still exists, please provide a detailed description of the steps to reproduce it.

TRANS_BY_GPT3

liyoung1992 commented 3 years ago

I also encountered a similar problem. rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470&Time=1629800410 It becomes rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470

I tested it and couldn't reproduce the issue. Please try using the latest version. If the problem still exists, please provide a detailed description of the steps to reproduce it.

Version 4.0 is fine, but it is still under development. To avoid this issue, remove the following field. Thanks to @duiniuluantanqin.

TRANS_BY_GPT3

duiniuluantanqin commented 3 years ago

I also encountered a similar problem. rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470&Time=1629800410 It becomes rtmp://172.31.160.249:1936/live/stream_test_20210825?Secret=19f46cbbf7bf17b1b35970b8e6c44470

I tested it and couldn't reproduce the issue. Please try using the latest version. If the problem still exists, please provide a detailed description of the steps to reproduce it.

Version 4.0 is fine, but it is still under development. To avoid this issue, let's remove the following field. Thanks @duiniuluantanqin.

Thank you for the feedback, I will test it with version 3.0 next week.

TRANS_BY_GPT3

duiniuluantanqin commented 3 years ago

@liyoung1992 I tested it with the latest version 3.0, but still couldn't reproduce it.

TRANS_BY_GPT3

duiniuluantanqin commented 3 years ago

This problem cannot be reproduced. May I ask if there is any latest update from both of you? If not, let's temporarily close it. @liyoung1992 @flhcd

TRANS_BY_GPT3