Fix frame variable count when varying frame lengths

The frame variable count should be minimum of frame count and frame
length range size.

Unrelated, in case of random payload pattern, reuse
StreamBase::frameCount() which does the same calculation.

Fixes #325
This commit is contained in:
Srivats P 2020-10-22 20:28:26 +05:30
parent 5edf9a75e5
commit a352ff3ed1
2 changed files with 3 additions and 18 deletions

View File

@ -232,24 +232,9 @@ int PayloadProtocol::protocolFrameVariableCount() const
int count = AbstractProtocol::protocolFrameVariableCount();
if (data.pattern_mode() == OstProto::Payload::e_dp_random)
{
switch(mpStream->sendUnit())
{
case OstProto::StreamControl::e_su_packets:
return mpStream->numPackets();
return mpStream->frameCount();
case OstProto::StreamControl::e_su_bursts:
return int(mpStream->numBursts()
* mpStream->burstSize()
* mpStream->burstRate());
}
}
if (mpStream->lenMode() != StreamBase::e_fl_fixed)
{
count = AbstractProtocol::lcm(count,
mpStream->frameLenMax() - mpStream->frameLenMin() + 1);
}
count = AbstractProtocol::lcm(count, mpStream->frameSizeVariableCount());
return count;
}

View File

@ -468,7 +468,7 @@ int StreamBase::frameSizeVariableCount() const
case OstProto::StreamCore::e_fl_inc:
case OstProto::StreamCore::e_fl_dec:
case OstProto::StreamCore::e_fl_random:
count = frameLenMax() - frameLenMin() + 1;
count = qMin(frameLenMax() - frameLenMin() + 1, frameCount());
break;
default:
qWarning("%s: Unhandled len mode %d", __FUNCTION__, lenMode());