Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Fix wrong stream getting disabled in interleaved mode
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pstavirs committed Nov 13, 2020
1 parent 640e702 commit 631f098
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/abstractport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ int AbstractPort::updatePacketListInterleaved()
int numStreams = 0;
quint64 minGap = ULLONG_MAX;
quint64 duration = quint64(1e9);
QList<int> streamId;
QList<quint64> ibg1, ibg2;
QList<quint64> nb1, nb2;
QList<quint64> ipg1, ipg2;
Expand Down Expand Up @@ -447,6 +448,8 @@ int AbstractPort::updatePacketListInterleaved()
if (!streamList_[i]->isEnabled())
continue;

streamId.append(i);

double numBursts = 0;
double numPackets = 0;

Expand All @@ -458,6 +461,7 @@ int AbstractPort::updatePacketListInterleaved()
quint64 _ipg1 = 0, _ipg2 = 0;
quint64 _np1 = 0, _np2 = 0;


switch (streamList_[i]->sendUnit())
{
case OstProto::StreamControl::e_su_bursts:
Expand Down Expand Up @@ -590,7 +594,7 @@ int AbstractPort::updatePacketListInterleaved()
{
FrameValueAttrib attrib;
buf = pktBuf_;
len = streamList_[i]->frameValue(pktBuf_, sizeof(pktBuf_),
len = streamList_[streamId.at(i)]->frameValue(pktBuf_, sizeof(pktBuf_),
pktCount[i], &attrib);
packetListAttrib += attrib;
}
Expand Down

0 comments on commit 631f098

Please sign in to comment.