Skip to content

SRS did not return data of a stream to the client #4656

Description

@18312828130

Hello, we encountered a problem while using SRS. We discussed and analyzed it internally for a long time and finally suspected that there might be an issue with SRS(the latest version). At that time, we also saw SRS issues on GitHub: 4480 and 4452, but we were not sure if it was the same problem.

The phenomena we observed at the time were:

  1. We have n cameras. Initially, each camera could preview video normally, but suddenly one camera went black and could not play, while previews from other cameras were fine. We found that SRS did not return the video stream data corresponding to the black screen camera to the browser or VLC, whereas other streams worked normally.
  2. This phenomenon occurs sporadically and is not fixed to any particular camera. As long as we restart SRS, the previously black-screen camera can preview again, and its corresponding stream works normally.
  3. We found that this problem is likely to occur in situations where different video streams are frequently pushed to SRS. One or more video streams will black screen when played via RTMP or HTTP-FLV, while HLS can play normally. After restarting SRS, the affected stream works normally, but another video stream may then experience the same issue.

The on-site information we collected using development tools is:

  1. When the browser could not preview a camera's video, we were using: ws://ip:8088/video/xxx.flv. Using the packet capture tool Wireshark, we found that the browser requested a connection to SRS and received handshake success packets and successfully established a WebSocket connection with SRS, but SRS did not push any data packets to the browser. Using VLC to request SRS, we found the same behavior.
  2. When the problem occurred, we checked the stream status through /api/v1/streams/ and found that send_bytes for the stream stopped changing, while recv_bytes kept increasing, meaning the stream should still be alive. The screenshots at the time were as follows:
Image
  1. We checked the SRS logs at the time and saw that SRS printed http: on_play ok ... response=0, indicating playback was allowed, but create consumer, active=0, meaning the corresponding consumer was not activated, and also saw cache=0... Screenshots at the time were as follows:
Image
  1. Our SRS configuration at the time was as follows:

listen 1935;
max_connections 1000;
#srs_log_tank file;
#srs_log_file /log/srs.log;
daemon on;
http_api {
enabled on;
#http-api端口
listen 1985;
#auth_token my_password;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
crossdomain off; #跨域选项
}

rtc_server {
enabled off;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}

vhost defaultVhost {
hls {
enabled on;
hls_fragment 1;
hls_window 10;
hls_acodec an;
hls_wait_keyframe off;
hls_cleanup on;
}

    play {
            gop_cache on;
    }

    http_remux {
            enabled on;
            mount[vhost] / [app] / [stream].flv;
            guess_has_av off;
            has_video on;
            has_audio off;
            fast_cache 10;
    }
    rtc {
            enabled on;
            rtmp_to_rtc off;
            rtc_to_rtmp off;

    }
    http_hooks {

            enabled on;
            on_play http://172.168.80.114:8082/onplay;
    }
    publish {
            normal_timeout 30000;
    }

}

Thank you for your open-source SRS, we look forward to your reply!
(We are very sorry, but due to various reasons, we are unable to use overseas communication platforms, and therefore cannot use your AI for inquiries.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions