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());
}
}
--------------------------------------------------------------------------------------------------------------------------------
_______________________________________________
Ccrtp-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/ccrtp-devel