> On May 22, 2023, at 8:00 PM, Liu, Eric via live-devel 
> <live-de...@us.live555.com> wrote:
> 
>  I’m using the live555 RTSP client to connect to an RTSP server (server A) 
> that redirects to the actual source of the video stream, server B. This works 
> well out of the box and the client is able to receive frames from server B as 
> expected. However, my use case requires me to additionally be able to get the 
> ip address of server B. Is this possible with the live555 library, either by 
> registering a callback or some other method?

The best way to do this would be to use the “source=“ parameter that’s in the 
response to each RTSP “SETUP” command.  You can access this in your RTSP client 
code - in your callback function that handles the response to each “SETUP” - 
without having to modify or even extend the LIVE555 library code.

Using the “testRTSPClient” code (in the “testProgs“ directory) as an example, 
in the “continueAfterSETUP()” function at around line 276 of 
“testRTSPClient.cpp”, you could add:

        char const* sourceStr = scs.subsession->connectionEndpointName(); // to 
get the source address, in string form
        int sourceAddressFamily = 
scs.subsession->connectionEndpointNameAddressFamily(); // AF_INET or AF_INET6

Or, instead, if you want the source address in numeric form, add:
        struct sockaddr_storage sourceAddress;
        scs.subsession->getConnectionEndpointAddress(sourceAddress); // 
“sourceAddress” now contains the IP (v4 or v6) address of the source
 

> As a bonus, it would be great if there is a method to get the ip address of 
> all intermediate redirects – for example, if my client connects to server A 
> which redirects to server B which redirects to server C, is it possible to 
> get the ip addresses of both server B and C?

In this case, because the presence of server B would be completely invisible to 
the RTSP client (it knows only the server to which it connects (A), and the 
source of its RTP packets (C)), there’s no possible way that the RTSP client 
could know about server B.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to