ccrtp-devel
[Top][All Lists]
Advanced

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

[Ccrtp-devel] Re:sending avi files


From: Mario Mateos
Subject: [Ccrtp-devel] Re:sending avi files
Date: Tue, 31 May 2005 16:34:53 +0000

Hi:

I made some changes in my program, but i continue with problems.
I'm trying to send an AVI file, using a program similar to audiotx demo program. My AVI file is 40,6 Mb long and contains 140 frames. I send them fragmented, and fragments are 8000 bytes long. The problem is that: a lot of fragments are lost and the packets don't arrive to the other machine at time, and the delay is increased more and more. I've tried to send the file reducing the rate, but no way. Somebody can help me?
I send parts of my code.

/*TRANSMITTER*/

#define MAXTAM 8000

class cTransmisorAVI:public RTPSession, public TimerPort, public CImagen
{
public:
   // Constructor.
cTransmisorAVI(char* filename, const InetHostAddress& ia,tpport_t port, uint32 tstamp):CImagen(filename), RTPSession(InetHostAddress("0.0.0.0")), packetspersecond(100)
   {
........................................................................
       setSchedulingTimeout(100000);
       setExpireTimeout(1000000);

       if( !addDestination(ia,port) )
       {
           cerr << "I could not connect.";
           exit();
       }

       setPayloadFormat(DynamicPayloadFormat(100, 90000));
       startRunning();

       uint16 tstampInc = getCurrentRTPClockRate()/packetspersecond;
       uint32 period = 1000/packetspersecond;
       TimerPort::setTimer(period);
..................................................................................

                             for (j = 0; j < (numpaqs - 1) ; j++)
       {
           p_sframe -> _numpaq = j+1;
           p_sframe -> _postrunk = (MAXTAM - lcabecera) * j;
           p_sframe -> _ldatos = (MAXTAM - lcabecera);

           memcpy (p_sframe -> _datos, frame1, p_sframe -> _ldatos);

putData(numframe*timestamp+j*tstampInc,(const unsigned char *)paq,lpaq);

           Thread::sleep(TimerPort::getTimer());
           TimerPort::incTimer(period);


           frame1 = frame1 + (MAXTAM - lcabecera);
       }
.........................................................................

main()
{
.............................
strcpy(dir, "158.227.66.63");
   strcpy(tstamp, "36000");
   strcpy(puerto, "3332");

cTransmisorAVI transmisor("trumpet01.avi", InetHostAddress(dir), atoi(puerto), atoi(tstamp));
}

/*RECEIVER*/

#define MAXTAM 8000
#define PERIOD 10

class cReceptorAVI: public TimerPort, public CImagen, private RTPSession
{
...............................
void recibe(void)
{
................................
setExpireTimeout(1000000);
setSchedulingTimeout(10000);

setPayloadFormat(DynamicPayloadFormat(100, 90000));
startRunning();

TimerPort::setTimer(PERIOD);
setCancel(cancelImmediate);
........................................
while(!fin)
{
              const AppDataUnit* adu;
   do
   {
       adu = getData(getFirstTimestamp());
       if ( NULL == adu )
       {
           Thread::sleep(5);
       }

   }
   while ( (NULL == adu) || (adu->getSize() <= 0) );


   memcpy (paq, (BYTE *) adu->getData(), adu->getSize());


   delete adu;

   cout << "." << flush;

   // Let's wait for the next cycle
   Thread::sleep(TimerPort::getTimer());
   TimerPort::incTimer(PERIOD);
......................................................
}
.....................................................
}

main()
{
...........................
   cReceptorAVI *receptor = new cReceptorAVI(local_ip, puerto);

   // Run it.
   receptor->recibe();

   cin.get();
..............................................
}

The "trumpet.avi" file is 40,6 Mb long, 140 frames and 68133 kbps.

Thanks for help

MARIO






reply via email to

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