fix(reflector): first-talker-wins arbitration for multi-monitor TGs

dc3a8c0's SelectedTgIdleFilter closed the v1.3.10 mixing window only
when the listener's selected TG was busy. When the selected TG is
idle (or 0) and >=2 monitor TGs have simultaneous talkers, the filter
let every frame through and the single Opus decoder mixed them --
a configuration MONITOR_TGS=1++,9+,110,112 hits this whenever 110 and 112
overlap, since svxlink's priority logic stays on the prio-1 TG 9.

TGHandler now records a per-TG talker-start timestamp (local + trunk),
retained across talker-clear so the flush-fanout filter can still
identify the freshly-stopped TG. ReflectorClient gains
EarliestMonitorTalkerFilter(tg): returns true iff tg is the earliest-
started TG (local OR trunk) among the client's monitored set; ties
broken by smaller TG id. Wired alongside the existing
SelectedTgIdleFilter at all nine UDP fanout sites. The selected-TG
arm of the OR is untouched, so svxlink priority and the pre-v1.3.10
single-TG-at-a-time invariant both keep working.

Adds test_43 (selected idle + two simultaneous monitor talkers ->
only earliest delivered) and test_44 (same, passive observer).
test_39 and test_40-42 remain green; full test_trunk.py: 47/47.
This commit is contained in:
Audric committed 2026-05-11 11:51:47 +02:00
1 parent 93f0274b9e
commit 5c585bebbc
9 files changed
+349 -9

No files matched your search

+6 -2
View File
@@ -1163,7 +1163,9 @@ void TrunkLink::handleMsgPeerAudio(std::istream& is)
ReflectorClient::TgFilter(local_tg),
ReflectorClient::mkAndFilter(
ReflectorClient::TgMonitorFilter(local_tg),
ReflectorClient::SelectedTgIdleFilter())));
ReflectorClient::mkAndFilter(
ReflectorClient::SelectedTgIdleFilter(),
ReflectorClient::EarliestMonitorTalkerFilter(local_tg)))));
// Forward trunk audio to connected satellites
m_reflector->forwardAudioToSatellitesExcept(nullptr, local_tg, msg.audio());
@@ -1203,7 +1205,9 @@ void TrunkLink::handleMsgPeerFlush(std::istream& is)
ReflectorClient::TgFilter(local_tg),
ReflectorClient::mkAndFilter(
ReflectorClient::TgMonitorFilter(local_tg),
ReflectorClient::SelectedTgIdleFilter())));
ReflectorClient::mkAndFilter(
ReflectorClient::SelectedTgIdleFilter(),
ReflectorClient::EarliestMonitorTalkerFilter(local_tg)))));
// Forward trunk flush to connected satellites
m_reflector->forwardFlushToSatellitesExcept(nullptr, local_tg);