From b0fe02e910e11afa7c0f642aaddc2c00f18a59f3 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nicolas.pope@utu.fi> Date: Thu, 10 Nov 2022 11:35:40 +0000 Subject: [PATCH] Run buffer until end packet --- src/streams/netstream.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/streams/netstream.cpp b/src/streams/netstream.cpp index b935c5b..7a1cb03 100644 --- a/src/streams/netstream.cpp +++ b/src/streams/netstream.cpp @@ -368,6 +368,7 @@ void Net::_run() { } auto current = state->buffer.begin(); + bool seenEnd = false; for (size_t i = 0; i < size; ++i) { // lk2.unlock(); @@ -375,13 +376,16 @@ void Net::_run() { // Should the packet be dispatched yet if (pts == ats) { - StreamPacket *spkt; DataPacket *pkt; - + spkt = ¤t->packets.first; pkt = ¤t->packets.second; + if (spkt->channel == Channel::kEndFrame) { + seenEnd = true; + } + ++state->active; ftl::pool.push([this, buf = &*current, spkt, pkt, state](int ix) { _processPacket(buf->peer, 0, *spkt, *pkt); @@ -393,7 +397,9 @@ void Net::_run() { nextTs = std::min(nextTs, next); hasLocalNext = true; hasNext = true; - break; + if (seenEnd) { + break; + } } // lk2.lock(); -- GitLab