[Live-devel] Is my way correct?

reza shah rshah0385 at yahoo.com
Wed Jun 16 02:57:26 PDT 2004


Hi guys,
I want to stream and receive speex data through RTP
(withour RTSP)
Assume we have two ips, 192.168.2.10 and 192.168.2.11
both are listening 
to port 8000.
I just want to make sure that my codes are ok, for
sending and receiving 
data. I still have trouble when receiving data.
Please if anyone has better way to send and receive
directly with RTP.

Here are my codes.
1. Server part send data to 192.168.2.11
    -- need comments for this part
    UsageEnvironment* mEnv;
    TaskScheduler* mScheduler;

    mScheduler = BasicTaskScheduler::createNew();
    mEnv =
BasicUsageEnvironment::createNew(*mScheduler);
    const unsigned short rtpPortNum = 8000;
    const unsigned short rtcpPortNum = rtpPortNum+1;
    struct in_addr destinationAddress;
    destinationAddress.s_addr =
our_inet_addr("192.168.2.11");
    const Port rtpPort(rtpPortNum);
    const Port rtcpPort(rtcpPortNum);

    audioRtpGroupsock = new Groupsock(*mEnv,
destinationAddress, 
rtpPort, 255);
    audioRtcpGroupsock = new Groupsock(*mEnv,
destinationAddress, 
rtcpPort, 255);
    audioRtcpInstance = RTCPInstance::createNew(*mEnv,
audioRtcpGroupsock,
                  160, CNAME,audioRtpSink,
NULL,False);
    audioRtpSink = 
SimpleRTPSink::createNew(*mEnv,audioRtpGroupsock,97,8000,"audio","speex",1,False,False);
    --end need comment

    then call audioRtpSink.

2. Client part receive data from 192.168.2.11
    -- need comments for this part
    UsageEnvironment* mEnv;
    TaskScheduler* mScheduler;

    unsigned short rtpPortNum = 8000;
    unsigned short rtcpPortNum = rtpPortNum +1;
   
    struct in_addr sessionAddress;
    sessionAddress.s_addr =
our_inet_addr("192.168.2.10");

    audioRtpSocket=new Groupsock(*env, sessionAddress,
rtpPortNum, ttl);
    audioRtcpSocket=new Groupsock(*env,
sessionAddress, rtcpPortNum, ttl);
    
audioSource=audioRTPSource=SimpleRTPSource::createNew(*env,audioRtpSocket,97,8000,"audio/speex",0,false);
    audioRtcpInstance = RTCPInstance::createNew(*env,
audioRtcpSocket,
            500, CNAME,NULL , audioRTPSource);
    --end need comments
    then call filesink method to write data to file.


Best Regards,
Reza

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the live-devel mailing list