ccrtp-devel
[Top][All Lists]
Advanced

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

[Ccrtp-devel] Can't send a packet with type sptL16_DUAL


From: Thomas Bosch
Subject: [Ccrtp-devel] Can't send a packet with type sptL16_DUAL
Date: Thu, 11 Aug 2005 12:45:52 +0200
User-agent: KMail/1.8.2

Hello.

I have written a simple code for testing out the ccrtp library. 
Now I'm wondering why the program hangs at the second send. The sptPCMA packet 
is sent and received correctly, but then the next packet isn't sent. When I 
swap the first and second send everything is okay. 
???
Why?

Thanks a lot


The source ist the following:
-------------------------------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <cstdlib>     
#include <ccrtp/rtp.h>

using namespace std;
using namespace ost;

void sendPacket(RTPSession *socket, StaticPayloadFormat format);
void receivePacket(RTPSession *socket);

int main(int argc, char *argv[])
{
        RTPSession *socket = new RTPSession(InetHostAddress("127.0.0.1"), 8000);
        socket->addDestination(InetHostAddress("127.0.0.1"), 9000);
        socket->startRunning();
        
        RTPSession *socket2 = new RTPSession(InetHostAddress("127.0.0.1"), 
9000);
        socket2->addDestination(InetHostAddress("127.0.0.1"), 8000);
        socket2->startRunning();
        
        // first send
        sendPacket(socket2, sptPCMA);
        while(!socket->isWaiting()) sleep(1);
        receivePacket(socket);
        
        // second send
        sendPacket(socket, sptL16_DUAL);
        while(!socket2->isWaiting()) sleep(1);
        receivePacket(socket2);
        
        delete socket;
        delete socket2;
        
        return EXIT_SUCCESS;
}

void sendPacket(RTPSession *socket, StaticPayloadFormat format)
{
        unsigned char data[1024];
        int ts = socket->getCurrentTimestamp();
        
        socket->setPayloadFormat(StaticPayloadFormat(format));
        socket->putData(ts, data, 1024);
}

void receivePacket(RTPSession *socket)
{
        int ts = socket->getFirstTimestamp();
        const AppDataUnit* adu;
        adu = socket->getData(ts);
        if ( adu != NULL ){
                printf("packet type: %d\n", adu->getType());
        }
}
--------------------------------------------------------------------------------------------------------------------------------




reply via email to

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