sending avi files

"Mario Mateos" <[email protected]>
Newsgroups gmane.comp.gnu.ccrtp.devel
Message-ID <[email protected]>
Hi:
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: 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.

/*TRANSMISOR*/

#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(10)
	{
                 
........................................................................
		setSchedulingTimeout(10000);
		setExpireTimeout(100000);

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

		setPayloadFormat(StaticPayloadFormat(sptPCMU));
		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, "32000");
	strcpy(puerto, "3332");

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

/*RECEIVER*/

#define MAXTAM 8000

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

setPayloadFormat(StaticPayloadFormat(sptPCMU));
startRunning();

TimerPort::setTimer(PERIOD);
setCancel(cancelImmediate);
........................................
while(!fin)
{
                const AppDataUnit* adu;
	do
	{
		adu = getData(getFirstTimestamp());
		if ( NULL == adu )
		{
			Thread::sleep(5);
		}
		else
                                                cout << ".";
	}
	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();
..............................................
}

Thanks for help

MARIO
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.