网络模拟没有排序

This commit is contained in:
张青阳 2021-05-28 11:41:51 +08:00
parent 77a4f85ae6
commit 6dffd97f64

12
test.h
View File

@ -194,11 +194,19 @@ public:
IUINT32 delay = rttmin; IUINT32 delay = rttmin;
if (rttmax > rttmin) delay += rand() % (rttmax - rttmin); if (rttmax > rttmin) delay += rand() % (rttmax - rttmin);
pkt->setts(current + delay); pkt->setts(current + delay);
DelayTunnel *tunnel;
if (peer == 0) { if (peer == 0) {
p12.push_back(pkt); tunnel = &p12;
}else{ }else{
p21.push_back(pkt); tunnel = &p21;
} }
auto iter = tunnel->crbegin();
for(;iter != tunnel->crend(); ++iter){
if((*iter)->ts() <= pkt->ts()){
break;
}
}
tunnel->insert(iter.base(), pkt);
} }
// 接收数据 // 接收数据