ngraziano / SharpRTSP

A RTSP handling library
Other
553 stars 182 forks source link

It would be helpful if RtspListener exposed the IP address of the local endpoint #131

Open bentorkington opened 1 week ago

bentorkington commented 1 week ago

This would be helpful when responding to RTSP DESCRIBE messages, allowing the server to put the correct response in the SDP 'o' line. Note that the examples in this project send 0.0.0.0, which isn't compliant with RTCP 4566 5.2:

I'm not sure the best way to implement this, however. Accessing the LocalEndPoint within RTSPTCPTransport will require casting it from EndPoint to IPEndPoint to access the Address property. This should be safe, as TcpClient shouldn't return another type of endpoint as far as I know.

Alternatively, using ToString() on the more general EndPoint class might suffice, but feels dirty, and you'd need to use a Regex to trim off the port number.

Thoughts?

ngraziano commented 1 week ago

I will look what I can do. I may return the IpEndPoint (it is safe to cast LocalEndPoint to that because we only do tcp in the 3 differents transport)

I think, we should also add RemoteEndpoint with type IpEndPoint in IRtspTransport to replace in the future RemoteAdress The extraction of the ip adress string from the IpEndPoint should be done not in the library.

I try to make this modification during this week.

bentorkington commented 1 week ago

I try to make this modification during this week.

I have a half-finished commit doing so, if you don't have time I'll try to get it submitted. Thank you!