Hi Ross, Thanks for you feedback again. One question. I'm confused about the order of operations, then. You claim I should call .changeDestinationparameters() with the sender's IP on the rtcpGroupSock before invoking RTCPInstance::createNew() on said socket, but before receiving the sender's IP I need to get traffic from it, and before getting traffic, don't I need to have invoked RTCPInstance::createNew()?
My understanding of the order is: 1. Create sink, 2. Create sockets, 3. Create RTP source, 4. Create RTCP instance, 5. Receive audio traffic, get sender's IP. 6. Then maybe update stuff with changeDestinationParameters()? Or am I misunderstanding what you're saying? Apologies if I'm being dense. On Tue, Jun 14, 2016 at 1:39 AM Ross Finlayson <finlay...@live555.com> wrote: > > I'm creating an audio "client" using RTPSource. I have a custom > MediaSink-derived class which takes the traffic and routes it to my > computer's audio device. Works great. > > > > What I'd like to do, however, is retrieve the sender's IP address (the > IP address of the sender which is sending traffic to the port/ip as > specified by my GroupSocks). How do I do this? > > Unfortunately the sender’s IP address (and port number) aren’t exposed > directly by our “*RTPSource” code, but there is a hack that you can use to > get this. > > The trick (hack) is to define a subclass of the “Groupsock” class, and, in > your subclass, reimplement the virtual function > virtual Boolean handleRead(unsigned char* buffer, unsigned > bufferMaxSize, unsigned& bytesRead, struct sockaddr_in& fromAddressAndPort); > In your subclass, you would implement this virtual function as follows: > Boolean yourGroupsockSubclass::handleRead(unsigned char* buffer, > unsigned bufferMaxSize, > unsigned& bytesRead, > struct sockaddr_in& fromAddressAndPort) { > Boolean result = Groupsock::handleRead(buffer, > bufferMaxSize, bytesRead, fromAddressAndPort); > if (result) { > // “fromAddressAndPort” is the sender’s IP address > (and port number); record it > } > > return result; > } > > Then, you would create your “RTPSource” object with an object of your > “Groupsock" subclass, rather than with a regular “Groupsock”. > > Also: > > RTCPInstance* rtcpInstance = > > RTCPInstance::createNew(*environment, &rtcpGroupSock, 5000, > CNAME, NULL, rtpSource); > > Before doing this, you should call > rtcpGroupSock.changeDestinationParameters() > with the sender’s IP address and port number, so that RTCP “RR” packets go > back to the sender. (And if you want to use “rtpGroupSock” to send audio > back to the sender (via a “RTPSink” object), then you should call > “changeDestinationParameters()” on “rtpGroupSock” as well.) > > > 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 >
_______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel