BogdanovKirill / RtspClientSharp

Pure C# RTSP client for .NET Standard without external dependencies and with true async nature. I welcome contributions.
MIT License
722 stars 286 forks source link

The client releases the connection under certain reponses #18

Closed luter58 closed 5 years ago

luter58 commented 5 years ago

Describe the bug When I try to connect to a given camera, it seems that the client releases the connection. See attached file Cnt168-error.pcapng.

VLC however connects correcly. See atacched file Cnt168-VLC.pcapng

In addition, your client connects correctly with other camera of the same manufacturer. See attached file Cnt168-ok.pcapng

The camera it fails with is a Grandstream GXV3674_FHD_VF v2. The one it works with is a Grandstream GXV3601_LL.

Best reagars, Manuel Heras

Captures.zip

BogdanovKirill commented 5 years ago

Describe the bug When I try to connect to a given camera, it seems that the client releases the connection. See attached file Cnt168-error.pcapng.

VLC however connects correcly. See atacched file Cnt168-VLC.pcapng

In addition, your client connects correctly with other camera of the same manufacturer. See attached file Cnt168-ok.pcapng

The camera it fails with is a Grandstream GXV3674_FHD_VF v2. The one it works with is a Grandstream GXV3601_LL.

Best reagars, Manuel Heras

Captures.zip

Hello!

Thank you for your feedback. Could you debug source code and find out where problem is ? Is it possible to provide access for me to your camera? I would like to research.

luter58 commented 5 years ago

Hi Kirill I've been looking into de code and this is what I've found: 1.- The program progresses to RtspTransportClient line 129 (see Capture-1.jpg). 2.- It enters ReadExactAsync. 3.- It starts ReadExactAsync. 4.- In StremExtensions.cs line 15 it waits for some data that seems not to arrive any more (see Capture-2.jpg).

Hope this helps.

Regards, Manuel ScreenCaptures.zip

BogdanovKirill commented 5 years ago

Hi Kirill I've been looking into de code and this is what I've found: 1.- The program progresses to RtspTransportClient line 129 (see Capture-1.jpg). 2.- It enters ReadExactAsync. 3.- It starts ReadExactAsync. 4.- In StremExtensions.cs line 15 it waits for some data that seems not to arrive any more (see Capture-2.jpg).

Hope this helps.

Regards, Manuel ScreenCaptures.zip

It seems that camera doesnt send full response for DESCRIBE request, pretty strange. Are sure that VLC always works well ? Could you check VLC logs please ? May be VLC makes several connection attempts? May be firmware update could help ?

luter58 commented 5 years ago

You can see what the camera sends in the Wireshark captures I sent. It seems that VLC connects at he first attempt, but I can check the messages it arises. What level of verbosity do you want to have: errors, warnings or debug?

BogdanovKirill commented 5 years ago

It seems that I've fixed this bug https://github.com/BogdanovKirill/RtspClientSharp/commit/2838fc3c2e1fb69e0f00cf531eda664a5011050a Please update to 1.2.5 version of nuget and give me feedback

BogdanovKirill commented 5 years ago

Any news?

BogdanovKirill commented 5 years ago

Please feel free to reopen it if required

TomCat666 commented 5 years ago

Hello.

I got an old Dahua IPcamera in the door bell which didn't work with this library. Stupidly I didn't check the repository if there is a fix before I did the same fix myself (after hours of debugging). However I needed to additionally do one more change in the RtspRequestMessage.cs ToString() method:

public override string ToString() { var queryBuilder = new StringBuilder(512);

        string url = ConnectionUri.ToString();
        if (url.EndsWith("/"))
        {
            url = url.Remove(url.Length - 1);
        }

....

It seems some cameras don't like the url's in the message to end with '/' character. I found this by checking what VLC sends to the camera and the only difference was this. After this and the fix you did with using the search for first occurance of CRLFCRLF instead of the last one this camera now works too.

BogdanovKirill commented 5 years ago

Hello.

I got an old Dahua IPcamera in the door bell which didn't work with this library. Stupidly I didn't check the repository if there is a fix before I did the same fix myself (after hours of debugging). However I needed to additionally do one more change in the RtspRequestMessage.cs ToString() method:

public override string ToString() { var queryBuilder = new StringBuilder(512);

        string url = ConnectionUri.ToString();
        if (url.EndsWith("/"))
        {
            url = url.Remove(url.Length - 1);
        }

....

It seems some cameras don't like the url's in the message to end with '/' character. I found this by checking what VLC sends to the camera and the only difference was this. After this and the fix you did with using the search for first occurance of CRLFCRLF instead of the last one this camera now works too.

Thank you very much for reply. Next time, open new ticket pelase. Could you give some additional details when we should remove last slash? It would be great if you create new ticket and descrtibe that problem