[Live-devel] sub-classing ProxyServerMediaSession

Craig Matsuura cmatsuura at vivint.com
Mon Dec 9 16:53:24 PST 2013


One working on sub classing ProxyServerMediaSession and also sub classing ProxyRTSPClient.  I have overridden the createNewProxyRTSPClient().  The problem I'm having is the createNewProxyRTSPClient() is called from the constructor of the ProxyServerMediaSession, and the method I just overrode is not being called.

According to the following post this is a know limitation with C++.

http://www.codeproject.com/Tips/641610/Be-Careful-with-Virtual-Method

I can modify the source directly, but thought I would ask first as I did a bunch of work to derive from the ProxyServerMediaSession and ProxyRTSPClient.

In the ProxyServerMediaSession.hh
protected:
  ProxyServerMediaSession(UsageEnvironment& env, RTSPServer* ourRTSPServer,
              char const* inputStreamURL, char const* streamName,
              char const* username, char const* password,
              portNumBits tunnelOverHTTPPortNum, int verbosityLevel, int socketNumToServer);

  // If you subclass "ProxyRTSPClient", then you should also subclass "ProxyServerMediaSession" and redefine this virtual function
  // in order to create new objects of your "ProxyRTSPClient" subclass:
  virtual ProxyRTSPClient* createNewProxyRTSPClient(char const* rtspURL, char const* username, char const* password,
                            portNumBits tunnelOverHTTPPortNum, int verbosityLevel, int socketNumToServer);

===========

In the ProxyServerMediaSession.cpp
ProxyServerMediaSession::ProxyServerMediaSession(UsageEnvironment& env, RTSPServer* ourRTSPServer,
                         char const* inputStreamURL, char const* streamName,
                         char const* username, char const* password,
                         portNumBits tunnelOverHTTPPortNum, int verbosityLevel, int socketNumToServer)
  : ServerMediaSession(env, streamName, NULL, NULL, False, NULL),
    describeCompletedFlag(0), fOurRTSPServer(ourRTSPServer), fClientMediaSession(NULL),
    fVerbosityLevel(verbosityLevel), fPresentationTimeSessionNormalizer(new PresentationTimeSessionNormalizer(envir())) {
  // Open a RTSP connection to the input stream, and send a "DESCRIBE" command.
  // We'll use the SDP description in the response to set ourselves up.
  fProxyRTSPClient = createNewProxyRTSPClient(inputStreamURL, username, password, tunnelOverHTTPPortNum,
                          verbosityLevel > 0 ? verbosityLevel-1 : verbosityLevel, socketNumToServer);
  ProxyRTSPClient::sendDESCRIBE(fProxyRTSPClient);
}

If I override the createNewProxyRTSPClient, and instanciate the new sub-class the ProxySErverMediaSession version of the createNewProxyRTSPClient is called, not my overriden version.


Thanks,
Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20131209/bbcad403/attachment.html>


More information about the live-devel mailing list