Fix wrong stream getting disabled in interleaved mode

When building packets in interleaved mode, we do 2 passes over the
streams.

In the first pass, we build a number of lists of variables for each
**enabled** stream. One of these variables is the pktBuf content.

In the second pass, we use these lists to build the packets. If the
stream is not variable, we just use the packet content built in the
first pass. However, if the stream is variable we call frameValue to get
the packet content, but we index with the wrong value into stream list
 if we have some disabled streams before us.

Fixes #328
This commit is contained in:
Srivats P 2020-11-13 21:48:36 +05:30
parent 640e7029b9
commit 631f0982fe

View File

@ -411,6 +411,7 @@ int AbstractPort::updatePacketListInterleaved()
int numStreams = 0; int numStreams = 0;
quint64 minGap = ULLONG_MAX; quint64 minGap = ULLONG_MAX;
quint64 duration = quint64(1e9); quint64 duration = quint64(1e9);
QList<int> streamId;
QList<quint64> ibg1, ibg2; QList<quint64> ibg1, ibg2;
QList<quint64> nb1, nb2; QList<quint64> nb1, nb2;
QList<quint64> ipg1, ipg2; QList<quint64> ipg1, ipg2;
@ -447,6 +448,8 @@ int AbstractPort::updatePacketListInterleaved()
if (!streamList_[i]->isEnabled()) if (!streamList_[i]->isEnabled())
continue; continue;
streamId.append(i);
double numBursts = 0; double numBursts = 0;
double numPackets = 0; double numPackets = 0;
@ -458,6 +461,7 @@ int AbstractPort::updatePacketListInterleaved()
quint64 _ipg1 = 0, _ipg2 = 0; quint64 _ipg1 = 0, _ipg2 = 0;
quint64 _np1 = 0, _np2 = 0; quint64 _np1 = 0, _np2 = 0;
switch (streamList_[i]->sendUnit()) switch (streamList_[i]->sendUnit())
{ {
case OstProto::StreamControl::e_su_bursts: case OstProto::StreamControl::e_su_bursts:
@ -590,7 +594,7 @@ int AbstractPort::updatePacketListInterleaved()
{ {
FrameValueAttrib attrib; FrameValueAttrib attrib;
buf = pktBuf_; buf = pktBuf_;
len = streamList_[i]->frameValue(pktBuf_, sizeof(pktBuf_), len = streamList_[streamId.at(i)]->frameValue(pktBuf_, sizeof(pktBuf_),
pktCount[i], &attrib); pktCount[i], &attrib);
packetListAttrib += attrib; packetListAttrib += attrib;
} }