srs MPEGTS over UDP: 超时后无法再使用

h9vpoimq  于 2022-10-27  发布在  其他
关注(0)|答案(1)|浏览(230)

Note: Please read FAQ before file an issue, see 2716

Note: 提问前,请先看FAQ, 即 2716

监听的UDP端口视频流推送断开一段时间(超过超时时间)再推送视频流服务报错,管理页面看不到视频流,也无法播放视频流,建议支持UDP端口的复用

Please description your issue here(描述你遇到了什么问题)

  1. SRS Version(版本): SRS-CentOS7-x86_64-5.0.33
  2. SRS Log(日志):
serve error code=1011 : service cycle : rtmp: stream service : rtmp: publish timeout 10000ms, nb_msgs=0
13.
thread [23868][1ps6r2p5]: do_cycle() [src/app/srs_app_rtmp_conn.cpp:217][errno=4]
14.
thread [23868][1ps6r2p5]: service_cycle() [src/app/srs_app_rtmp_conn.cpp:414][errno=4]
15.
thread [23868][1ps6r2p5]: do_publishing() 

[2022-07-10 15:07:11.634][Warn][20618][33868fm5][32] parse ts packet err=code=1009 : ts: handle ts message : ts: consume audio : write audio raw frame : send messages : send messages : send iovs : writev : writev
719.
thread [20618][33868fm5]: decode() [src/kernel/srs_kernel_ts.cpp:267][errno=32]
720.
thread [20618][33868fm5]: on_ts_message() [src/app/srs_app_mpegts_udp.cpp:318][errno=32]
721.
thread [20618][33868fm5]: on_ts_audio() [src/app/srs_app_mpegts_udp.cpp:530][errno=32]
722.
thread [20618][33868fm5]: rtmp_write_packet() [src/app/srs_app_mpegts_udp.cpp:584][errno=32]
723.
thread [20618][33868fm5]: send_and_free_messages() [src/protocol/srs_rtmp_stack.cpp:822][errno=32]
724.
thread [20618][33868fm5]: do_send_messages() [src/protocol/srs_rtmp_stack.cpp:528][errno=32]
725.
thread [20618][33868fm5]: srs_write_large_iovs() [src/protocol/srs_protocol_utility.cpp:357][errno=32]
726.
thread [20618][33868fm5]: writev() [src/protocol/srs_service_st.cpp:609][errno=32]
727.
�[0m[2022-07-10 15:07:11.635][Trace][20618][00209r55] RTMP client ip=127.0.0.1:33334, fd=15
728.
[2022-07-10 15:07:11.641][Trace][20618][33868fm5] complex handshake success.
729.
[2022-07-10 15:07:11.641][Trace][20618][33868fm5] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128

parse ts packet err=code=4019 : ts: ts packet decode : ts: demux payload : ts: PES fresh packet length=0, us=0, cc=11

parse ts packet err=code=1009 : ts: handle ts message : ts: consume audio : write audio raw frame : send messages : send messages : send iovs : writev : writev

serve error code=5011 : service cycle : rtmp: stream service : rtmp: receive thread : handle publish message : rtmp: consume message : rtmp: consume audio : bridger consume audio : aac append header : adts

ts: drop PES 13B for duplicated cc=0xb8
  1. SRS Config(配置):

# main config for srs.

# @see full.conf for detail config.

listen              21935;
max_connections     1000;
srs_log_tank        console;
srs_log_file        ./objs/srs.log;
daemon              off;
http_api {
    enabled         on;
    listen          21985;
}
http_server {
    enabled         on;
    listen          28080;
    dir             ./objs/nginx/html;
}
rtc_server {
    enabled on;
    listen 28000; # UDP port
    # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
    candidate $CANDIDATE;
}

stream_caster {
    enabled         on;
    caster          mpegts_over_udp;
    output          rtmp://127.0.0.1:21935/live/line1;
    listen          8935;
}

stream_caster {
    enabled         on;
    caster          mpegts_over_udp;
    output          rtmp://127.0.0.1:21935/live/line2;
    listen          8936;
}

stream_caster {
    enabled         on;
    caster          mpegts_over_udp;
    output          rtmp://127.0.0.1:21935/live/line3;
    listen          8937;
}

stream_caster {
    enabled         on;
    caster          mpegts_over_udp;
    output          rtmp://127.0.0.1:21935/live/line4;
    listen          8938;
}

stream_caster {
    enabled         on;
    caster          mpegts_over_udp;
    output          rtmp://127.0.0.1:21935/live/line5;
    listen          8939;
}

vhost __defaultVhost__ {
    hls {
        enabled         on;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    rtc {
        enabled     on;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
        rtmp_to_rtc on;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
        rtc_to_rtmp off;
    }
	publish {
        # about MR, read https://github.com/ossrs/srs/issues/241
        # when enabled the mr, SRS will read as large as possible.
        # default: off
        mr          off;
        # the latency in ms for MR(merged-read),
        # the performance+ when latency+, and memory+,
        #       memory(buffer) = latency * kbps / 8
        # for example, latency=500ms, kbps=3000kbps, each publish connection will consume
        #       memory = 500 * 3000 / 8 = 187500B = 183KB
        # when there are 2500 publisher, the total memory of SRS at least:
        #       183KB * 2500 = 446MB
        # the recommended value is [300, 2000]
        # default: 350
        mr_latency  350;

        # the 1st packet timeout in ms for encoder.
        # default: 20000
        firstpkt_timeout    10000;
        # the normal packet timeout in ms for encoder.
        # default: 5000
        normal_timeout      10000;
        # whether parse the sps when publish stream.
        # we can got the resolution of video for stat api.
        # but we may failed to cause publish failed.
        # @remark If disabled, HLS might never update the sps/pps, it depends on this.
        # default: on
        parse_sps   on;
    }
}

Replay(重现)

Please describe how to replay the bug? (重现Bug的步骤)

  1. 使用udp推送视频流
  2. 停止推送服务超过10秒
  3. 再次通过相同的udp端口推送视频流

超过超时时间也能恢复中断的udp接收转发rtmp的服务,否则一旦断开超时就会导致配置的stream_caster转发端口不可用

Please describe your expectation(描述你期望发生的事情)

3htmauhk

3htmauhk1#

目前通过修改代码已经解决问题,stream_caster udp接收的链接最好是一直在的,否则超时断了之后就无法再复用了

相关问题