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.librtmp cannot connect to FMS/RED5

backylee opened this issue · comments

commented

srs.librtmp is a modified version of librtmp. Testing the integration of srs.librtmp with both srs and nginx-rtmp is successful. However, testing the integration with FMS and RED5 has failed. Wenjie's BLE uses librtmp and has no issues with integrating with FMS. Maintaining compatibility with librtmp is of great significance for srs.librtmp, especially considering that FMS and RED5 are leading players in the field.

TRANS_BY_GPT3

Just state the problem directly, and I will assess whether it needs to be corrected.

TRANS_BY_GPT3

The problem with integrating RED5 (1.0.6-release) is that the RTMP Body structure of '_result('NetConnection.Connect.Success')' is String, Number, NULL, Object. The current SrsConnectAppResPacket::decode function handles the NULL case incorrectly. I have made the following changes to fix it.

char marker = stream->read_1bytes();
if (marker == RTMP_AMF0_Null) {
    return ret;
}

TRANS_BY_GPT3

FMS for some reason, it seems that after sending this SrsSetWindowAckSizePacket, no data can be read anymore.

TRANS_BY_GPT3

The RTMP protocol should not be Null, but this can be compatible.

TRANS_BY_GPT3

It seems that the problem with fms has been found.
Using a simple handshake requires c2 to be equal to s1.

TRANS_BY_GPT3

@illuspas It seems to be an equivalent, huh? Have you tried it? Can we bypass it by changing it to a complex handshake? Or would it be possible to bypass it by making c2 equal to s1?

TRANS_BY_GPT3

I didn't try a complicated handshake. I directly copied the memory in SrsHandshakeBytes::create_c2() and it worked. Previously, the handshake was successful, but when I continued to send another packet of data, the fms forcibly closed the socket. Checking the status with netstat showed it changed to FIN_WAIT_2.
The test was done on FMS 4.5 windows.

c2 = new char[1536];
memcpy(c2, s0s1s2+1, 1536);

TRANS_BY_GPT3

Okay, let me confirm again.

TRANS_BY_GPT3

@illuspas When performing a simple handshake, c2 becomes equal to s1.

TRANS_BY_GPT3

@illuspas Regarding the issue of the structure returned by RED5, which is RTMP Body structure is String, Number, NULL, Object, you should first read one and check if it is NULL before ignoring it. You cannot directly return it.

TRANS_BY_GPT3

srs-librtmp is removed in SRS4.