本文整理汇总了C++中PacketsPattern::getPacketSize方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketsPattern::getPacketSize方法的具体用法?C++ PacketsPattern::getPacketSize怎么用?C++ PacketsPattern::getPacketSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketsPattern
的用法示例。
在下文中一共展示了PacketsPattern::getPacketSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doTest
int doTest()
{
// should be valid?
//RTPSession tx();
RTPSession tx(InetHostAddress("localhost"));
tx.setSchedulingTimeout(10000);
tx.setExpireTimeout(1000000);
tx.startRunning();
tx.setPayloadFormat(StaticPayloadFormat(sptPCMU));
if ( !tx.addDestination(pattern.getDestinationAddress(),
pattern.getDestinationPort()) ) {
return 1;
}
// 50 packets per second (packet duration of 20ms)
uint32 period = 20;
uint16 inc = tx.getCurrentRTPClockRate()/50;
TimerPort::setTimer(period);
for ( uint32 i = 0; i < pattern.getPacketsNumber(); i++ ) {
tx.putData(i*inc, pattern.getPacketData(i), pattern.getPacketSize(i));
Thread::sleep(TimerPort::getTimer());
TimerPort::incTimer(period);
}
return 0;
}
示例2: doTest
int doTest() {
// should be valid?
//RTPSession tx();
// Initialize with local address and Local port is detination port +2 - keep RTP/RTCP port pairs
ExtZrtpSession tx(pattern.getSsrc(), pattern.getSenderAddress(), pattern.getSenderPort());
tx.initialize("test_t.zid");
tx.setSchedulingTimeout(10000);
tx.setExpireTimeout(1000000);
tx.startRunning();
tx.setPayloadFormat(StaticPayloadFormat(sptPCMU));
if (!tx.addDestination(pattern.getReceiverAddress(), pattern.getReceiverPort()) ) {
return 1;
}
tx.startZrtp();
// 2 packets per second (packet duration of 500ms)
uint32 period = 500;
uint16 inc = tx.getCurrentRTPClockRate()/2;
TimerPort::setTimer(period);
uint32 i;
for (i = 0; i < pattern.getPacketsNumber(); i++ ) {
tx.putData(i*inc,
pattern.getPacketData(i),
pattern.getPacketSize(i));
cout << "Sent some data: " << i << endl;
Thread::sleep(TimerPort::getTimer());
TimerPort::incTimer(period);
}
tx.putData(i*inc, (unsigned char*)"exit", 5);
Thread::sleep(200);
return 0;
}