Do not send PreviousLoopback output packets to closed streams

PiperOrigin-RevId: 544449979
This commit is contained in:
MediaPipe Team 2023-06-29 13:42:27 -07:00 committed by Copybara-Service
parent 52cea59d41
commit e15d5a797b

View File

@ -123,8 +123,11 @@ class PreviousLoopbackCalculator : public Node {
// However, LOOP packet is empty. // However, LOOP packet is empty.
kPrevLoop(cc).SetNextTimestampBound(main_spec.timestamp + 1); kPrevLoop(cc).SetNextTimestampBound(main_spec.timestamp + 1);
} else { } else {
// Avoids sending leftovers to a stream that's already closed.
if (!kPrevLoop(cc).IsClosed()) {
kPrevLoop(cc).Send(loop_candidate.At(main_spec.timestamp)); kPrevLoop(cc).Send(loop_candidate.At(main_spec.timestamp));
} }
}
loop_packets_.pop_front(); loop_packets_.pop_front();
main_packet_specs_.pop_front(); main_packet_specs_.pop_front();
} }