[Live-devel] Lost consideration about SSM on Windows XP with VS6.

Brain Lai brainlai at gmail.com
Wed Nov 21 04:30:54 PST 2007


Dear Sir:

The fourth parameter "forceMulticastOnUnspecified" of
RTSPClient::setupMediaSubsession() will guide the client agent to setup a
multicast subsession if the IP address is not specified in SDP. The client
will then join the multicast group later by calling
subsession.setDestinations(fServerAddress) which then invokes
fRTPSocket->changeDestinationParameters(destAddr, destPort, destTTL).
However, Groupsock::changeDestinationParameters() doesn't consider if it has
a source filter address specified in SDP and just try a regular multicast
address group leave and join.

Hence, I suggest to modify as follows:

Groupsock::changeDestinationParameters(...) {
...
...
if (newDestAddr.s_addr != 0) {
    if (newDestAddr.s_addr != destAddr.s_addr
    && IsMulticastAddress(newDestAddr.s_addr)) {
      // If the new destination is a multicast address, then we assume that
      // we want to join it also.  (If this is not in fact the case, then
      // call "multicastSendOnly()" afterwards.)

      if (isSSM()) {
            if (!socketLeaveGroupSSM(env(), socketNum(), destAddr.s_addr,
sourceFilterAddress().s_addr))
                socketLeaveGroup(env(), socketNum(), destAddr.s_addr);

            else
              socketLeaveGroup(env(), socketNum(), groupAddress().s_addr);

            if (!socketJoinGroupSSM(env(), socketNum(), newDestAddr.s_addr,
sourceFilterAddress().s_addr)) {
                if (DebugLevel >= 3) {
                    env() << *this << ": SSM join failed: " <<
env().getResultMsg();
                    env() << " - trying regular join instead\n";
                }
                if (!socketJoinGroup(env(), socketNum(), newDestAddr.s_addr))
{
                    if (DebugLevel >= 1)
                        env() << *this << ": failed to join group: " <<
env().getResultMsg() << "\n";
                }
            }
        } else {
            socketLeaveGroup(env(), socketNum(), destAddr.s_addr);
            socketJoinGroup(env(), socketNum(), newDestAddr.s_addr);
        }
    }
    destAddr.s_addr = newDestAddr.s_addr;
}
...
}


Besides, the ws2tcpip.h provided in a newly installed Visual Studio C++ 6
doesn't define IP_ADD_SOURCE_MEMBERSHIP and IP_DROP_SOURCE_MEMBERSHIP so the
following conditional macro in GroupHelper.cpp wiill  define them as wrong
values on  Windows.

#ifdef LINUX
#define IP_ADD_SOURCE_MEMBERSHIP   39
#define IP_DROP_SOURCE_MEMBERSHIP 40
#else
#define IP_ADD_SOURCE_MEMBERSHIP   25   // should be 15 on Windows
#define IP_DROP_SOURCE_MEMBERSHIP 26  // should be 16 on Windows
#endif

Therefore, I suggest modify the above as the following:

#ifdef LINUX
#define IP_ADD_SOURCE_MEMBERSHIP   39
#define IP_DROP_SOURCE_MEMBERSHIP 40
#elif defined(WINNT) || defined(_WINNT)
#define IP_ADD_SOURCE_MEMBERSHIP  15 /* join IP group/source */
#define IP_DROP_SOURCE_MEMBERSHIP 16 /* leave IP group/source */
#define IP_BLOCK_SOURCE           17 /* block IP group/source */
#define IP_UNBLOCK_SOURCE         18 /* unblock IP group/source */
#define IP_PKTINFO                19 /* receive packet information for
ipv4*/
#define IP_RECEIVE_BROADCAST      22 /* allow/block broadcast reception */
#else
#define IP_ADD_SOURCE_MEMBERSHIP   25
#define IP_DROP_SOURCE_MEMBERSHIP 26
#endif

BR
Brain Lai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20071121/9b686c8d/attachment.html 


More information about the live-devel mailing list