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

Commit

Permalink
Use pkt-set delay instead of list's in intlvd mode
Browse files Browse the repository at this point in the history
Since we now create an explicit packet set even for interleaved mode, we can
calculate and use the packet set delay instead of using the list loop delay.

With this change both sequential and interleaved mode do not use list loop
delay at all, but we still retain the code for that - in case we need to use
it later for some reason.
  • Loading branch information
pstavirs committed Jun 22, 2023
1 parent c044880 commit 1fa84ec
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions server/abstractport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,19 +737,23 @@ int AbstractPort::updatePacketListInterleaved()
}
} while ((sec < durSec) || ((sec == durSec) && (nsec < durNsec)));

qint64 delaySec = durSec - lastPktTxSec;
qint64 delayNsec = durNsec - lastPktTxNsec;
while (delayNsec < 0)
{
delayNsec += long(1e9);
delaySec--;
}

// XXX: For interleaved mode, we ALWAYS have a single packet set with
// one repeat and 0 set delay
// TODO: Since we now create an explicit packet set, we can also calc
// the actual packet set delay and set it here and set list loop delay
// as 0
loopNextPacketSet(totalPkts, 1, 0, 0);
// one repeat
loopNextPacketSet(totalPkts, 1, delaySec, delayNsec);
qDebug("Interleaved single PacketSet of size %lld, duration %llu.%09llu "
"repeat 1 and delay 0",
totalPkts, durSec, durNsec);
"repeat 1 and delay %lld.%09lld",
totalPkts, durSec, durNsec, delaySec, delayNsec);

// Reset working sched/counts before building the packet list
sec = nsec = 0;
lastPktTxSec = lastPktTxNsec = 0;
for (int i = 0; i < numStreams; i++)
{
schedSec[i] = 0;
Expand Down Expand Up @@ -792,8 +796,6 @@ int AbstractPort::updatePacketListInterleaved()
packetListAttrib.errorFlags |= FrameValueAttrib::OutOfMemoryError;
goto _out_of_memory;
}
lastPktTxSec = sec;
lastPktTxNsec = nsec;

pktCount[i]++;
schedNsec[i] += (pktCount.at(i) < np1.at(i)) ?
Expand Down Expand Up @@ -823,17 +825,9 @@ int AbstractPort::updatePacketListInterleaved()
}
} while ((sec < durSec) || ((sec == durSec) && (nsec < durNsec)));

{
qint64 delaySec = durSec - lastPktTxSec;
qint64 delayNsec = durNsec - lastPktTxNsec;
while (delayNsec < 0)
{
delayNsec += long(1e9);
delaySec--;
}
qDebug("loop Delay = %lld.%09lld", delaySec, delayNsec);
setPacketListLoopMode(true, delaySec, delayNsec);
}
// XXX: The single packet has the delay, so no list loop delay required
// XXX: Both seq/interleaved mode no longer use list loop delay!
setPacketListLoopMode(true, 0, 0);

// XXX: TTag repeat interval calculation:
// CASE 1. pktListDuration < kTtagTimeInterval:
Expand Down

0 comments on commit 1fa84ec

Please sign in to comment.