ccrtp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ccrtp-devel] RTCP & Multicast problem


From: Remi Verchere
Subject: [Ccrtp-devel] RTCP & Multicast problem
Date: 24 Jun 2003 18:09:50 +0200

Hi,

I have a problem using multicast & RTCP packets.
I've made a simple program that only connect to multicast session, sends
"fake" data (just "puData(0,null,0)")& print out RTCP reports.
The problem is that I can print RR reports only using InetHostAddress
(unicast), and it doesn't work with InetMcastAddress. You'll find above
the sample source code.
Another problem is that the program doesn't make the difference between
RR & SR reports. How this thing can be resolved ??

here is a my source code :


========================================================================

class monServeur: public RTPSession, public TimerPort /* heritage de la
classe RTPSession */ {

public:
        monServeur(InetHostAddress &ia, tpport_t port):
                RTPSocket(ia, port) // constructeur de RTPSession, Unicast
        {
                cout << "creation socket unicast" << endl;
                myia = ia ;
                myport = port ;
                setUnicast();
                cout << "@ : " << myia << ":" << myport << endl ;
        }
        
        monServeur(InetMcastAddress &ima, tpport_t port):
                RTPSocket(ima, port) // constructeur de RTPSession, Multicast
        {
                cout << "creation socket multicast" << endl;
                myima = ima ;
                myport = port ;
                setMulticast();
                cout << "@ : " << myima << ":" << myport << endl ;
        }

        int setup()
        {
                cout << "SSRC identifier : " << hex << (int)getLocalSSRC() << 
endl ;
                defaultApplication().setSDESItem(SDESItemTypeTOOL, "Serveur 
RTP");
                // TODO -> ajouter les infos SDES (cname, email, ....)
                if(isMulticast())
                {
                        cerr << "(ok multicast)" << endl;
                        if( !addDestination(myima, myport))
                        {
                                cerr << "impossible de se connecter" << endl;
                                return(-1);
                        }
                }       
                else
                {
                        if( !addDestination(myia, myport))
                        {
                                cerr << "impossible de se connecter" << endl;
                                return(-1);
                        }
                }

                setPayloadFormat(StaticPayloadFormat(sptPCMU));
                startRunning(); //c parti !!
                return(1);
        }
        

        int go()
        {
                cout << "server is running" << endl ;
                for(;;)
                {
                        putData(0,NULL,0);
                }
        }
        bool isMulticast()
        {
                return multi ;
        }


        //Gestion des paquets RTCP
        void onNewSyncSource(const SyncSource &SR)
        {
                cout << "nouvelle source connectee " << endl;
        }

        void onGotSR(SyncSource &source, SendReport &SR, uint8 blocks)
        {
                RTPSession::onGotSR(source, SR, blocks);
                cout << "SR Report : " << hex << (int)source.getID() << endl ;
        }

        void onGotRR(SyncSource &source, RecvReport &RR, uint8 blocks)
        {
                RTPSession::onGotRR(source, RR, blocks);
                cout << "RR Report : " << hex << (int)source.getID() << endl ;
        }


private:
        InetHostAddress myia ; // @ unicast
        InetMcastAddress myima ; // @ multicast
        tpport_t myport ; // port
        bool multi ; // pour savoir si on est en unicast(false) ou multi(true)
        uint32 mytimestamp ; // timestamp
        
        void setMulticast()
        {
                multi=true;
        }

        void setUnicast()
        {
                multi=false;
        }

};      
                

int main(int argc, char* argv[])
{
        monServeur *letgo ;
        InetHostAddress ia("127.0.0.1") ; // @ unicast
        InetMcastAddress ima("239.1.1.1"); // @ multicast
        tpport_t port(8888) ;

        //config du serveur RTP
        letgo = new monServeur(ia, port);
        letgo->setup();
        letgo->go();
}
==================================================================

Thanks for your help,

Remi Verchere
-- 
Remi Verchere <address@hidden>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]