From 7a0fbb0e416f370c7248fa42a47e6826a49015ed Mon Sep 17 00:00:00 2001 From: Kevin Matz Date: Sun, 29 Aug 2021 11:18:45 -0400 Subject: [PATCH] note that 0 sequences can expose bugs --- protocols/sacn/receiver.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/protocols/sacn/receiver.cpp b/protocols/sacn/receiver.cpp index 9d83ad4..4875593 100644 --- a/protocols/sacn/receiver.cpp +++ b/protocols/sacn/receiver.cpp @@ -232,14 +232,18 @@ void Receiver::dataFrameHandler(ACN::PDU::Message frame) { /// > is less than or equal to 0, but greater than -20, /// > then the packet containing sequence number B shall be deemed out of /// > sequence and discarded. + /// \bug The standard requires that transmitters send incrimenting sequence + /// numbers, but many sources do not. By tolerating out-of-spec sources + /// transmitting 0s instead of a sequence number, the receiver must operate + /// in a mode where it cannnot detect missing or out-of-sequence packets. auto a = universe->provenance()->sequence_number; auto b = source->sequence_number; - int8_t dif = b - a; - if (dif <= 0 && dif > -20) - /// Tolerate out-of-spec sources transmitting 0s instead of a sequence number. - if (!(a == 0 && b == 0)) - return; - + if (!(a == 0 && b == 0)) + { + int8_t dif = b - a; + if (dif <= 0 && dif > -20) + return; + } // PDU data will be a block of DMP auto block = static_cast*>(frame->data());