ngraziano / SharpRTSP

A RTSP handling library
Other
519 stars 181 forks source link

Rtsp over Http #97

Closed Revan1985 closed 5 months ago

Revan1985 commented 5 months ago

Hi, I have added the Rtsp over Http for this project. This has been tested with some cameras, but be aware that someone does not work correctly. Some Bosch cameras just reject the authentication, also if in the Rtp packet, or http one, and I am still investigating the cause as we intergate them for work (tried other brands, and seems work fine, also with the "complete" digest auth).

I have mixed some code from another library for some inspirations, that has the same license (MIT) (RtspClientSharp).

ngraziano commented 5 months ago

Thanks for the code. There is a lot of change, I need to take a look and I have some question. About MD5, why are you adding a custom implementation ? I would prefer to keep the system one, if there is no valid reason.

About the ArrayPool for Data and the add of DataLength, I'm not sure I like that, because the responsibility to return the data to the pool is not clear to the user and the DataLength change may break some program silently. Can you put this in another pull request.

ngraziano commented 5 months ago

For Data, you may return a ReadOnlySpan or ReadOnlyMemory with the good size and have an other property DataBuffer with the raw byte[]; but there is still the possibility the client "Return" the buffer and continue to use the RTSPChunk. The other possibility is to make it Disposable and Return the array in Dispose(bool) but it change the way to handle it.

Revan1985 commented 5 months ago

Hello ngraziano, I will check this for better coding (yes, this changes are too breaking for other repositories using this library). I have done this little mixing, because I am using this library in a .net472 project (cannot update to new net versions, we are using too much outdated libraries). I will create a new branch, and try to implement better the code, so will not break the dotnetcore one.