ossrs / srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.

Home Page:https://ossrs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

srs_error_t SrsRtmpServer::handshake() The logic inside here is problematic.

zhenchengdezhichi opened this issue · comments

srs_error_t SrsRtmpServer::handshake()
{
srs_error_t err = srs_success;

srs_assert(hs_bytes);

SrsComplexHandshake complex_hs;
if ((err = complex_hs.handshake_with_client(hs_bytes, io)) != srs_success) {
    if (srs_error_code(err) == ERROR_RTMP_TRY_SIMPLE_HS) {
        srs_freep(err);
        
        SrsSimpleHandshake simple_hs;
        if ((err = simple_hs.handshake_with_client(hs_bytes, io)) != srs_success) {
            return srs_error_wrap(err, "simple handshake");
        }
    }
    return srs_error_wrap(err, "complex handshake");
}

srs_freep(hs_bytes);

return err;

}

If I go for a simple handshake and it succeeds, will I still execute return srs_error_wrap(err, "complex handshake");? In that case, err will not be srs_success. Please confirm.

TRANS_BY_GPT3

The version I just downloaded has the same test results as yours. Additionally, currently IPV4 is handling errors and connection failures. The previous older version did not have this issue.

TRANS_BY_GPT3

I now comment out the sentence "return srs_error_wrap(err, "complex handshake");", but it still doesn't work. I found that the video data still cannot be transmitted properly through packet capture. @ZiJinMountain, what version are you currently using?

TRANS_BY_GPT3

The version I am using should be the 3.0 version that has been around for almost a year, and the error code format has not been changed since then.
I didn't see any issues in the process from the screenshot you provided. Can you please describe it in more detail?
I am using a camera to stream to the SRS server, and the new version is causing connection failures. According to the log printout, there seems to be confusion between IPV4 and IPV6, and SRS is not recognizing it.
I haven't tried using ffmpeg for streaming in the new version yet. @zhenchengdezhichi

TRANS_BY_GPT3

I am using the latest version and streaming files with ffmpeg. Currently, I have only captured one video data packet, and then ffmpeg encountered an error.
image
@ZiJinMountain, do you have any trial codes available?

TRANS_BY_GPT3

The live streaming was successful. I found that the issue was with the content of my h264 file. There was some unnecessary information at the beginning, which should not start with 67 or 68.

TRANS_BY_GPT3

When Complex fails to switch to Simple handshake, there is a logic issue, missing an else statement.

TRANS_BY_GPT3