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

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

Closed
zhenchengdezhichi opened this issue Jan 27, 2018 · 7 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@zhenchengdezhichi
Copy link

zhenchengdezhichi commented Jan 27, 2018

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

@ZiJinMountain
Copy link

ZiJinMountain commented Jan 27, 2018

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

@zhenchengdezhichi
Copy link
Author

zhenchengdezhichi commented Jan 29, 2018

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

@zhenchengdezhichi
Copy link
Author

image

@ZiJinMountain
Copy link

ZiJinMountain commented Jan 30, 2018

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

@zhenchengdezhichi
Copy link
Author

zhenchengdezhichi commented Jan 30, 2018

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

@zhenchengdezhichi
Copy link
Author

zhenchengdezhichi commented Jan 31, 2018

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

@winlinvip
Copy link
Member

winlinvip commented Feb 13, 2018

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

TRANS_BY_GPT3

@winlinvip winlinvip added the Bug It might be a bug. label Feb 13, 2018
@winlinvip winlinvip added this to the srs 3.0 release milestone Feb 13, 2018
@winlinvip winlinvip self-assigned this Sep 12, 2021
@winlinvip winlinvip changed the title srs_error_t SrsRtmpServer::handshake() 这里面的逻辑有问题 srs_error_t SrsRtmpServer::handshake() The logic inside here is problematic. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 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

No branches or pull requests

3 participants