TwinLink: mirror local-client talker and audio to partner

Outbound: onLocalTalkerUpdated/onLocalAudio/onLocalFlush now send
MsgTrunkTalkerStart/Stop, MsgTrunkAudio, MsgTrunkFlush over the twin
TCP connection when isActive().

Receive-side: handleMsgTrunkTalkerStart/Stop call
TGHandler::setTrunkTalkerForTG / clearTrunkTalkerForTG, which fires
trunkTalkerUpdated → Reflector::onTrunkTalkerUpdated, broadcasting
MsgTalkerStart/Stop to local clients. handleMsgTrunkAudio and
handleMsgTrunkFlush call Reflector::broadcastUdpMsg directly.

Reflector::onTalkerUpdated (talkerUpdated signal handler) now notifies
m_twin_link after the trunk/satellite loops. MsgUdpAudio and
MsgUdpFlushSamples handlers similarly call m_twin_link->onLocalAudio/
onLocalFlush in the non-satellite branch.

No echo loop: trunkTalkerUpdated (twin receive path) is distinct from
talkerUpdated (local-client signal that drives outbound sends).
This commit is contained in:
Audric committed 2026-04-15 21:18:24 +02:00
1 parent 9b748d1bdc
commit 2554efb392
2 files changed
+72 -16

No files matched your search

+15
View File
@@ -1415,6 +1415,10 @@ void Reflector::udpDatagramReceived(const IpAddress& addr, uint16_t port,
{
kv.second->onParentAudio(tg, msg.audioData());
}
if (m_twin_link != nullptr)
{
m_twin_link->onLocalAudio(tg, msg.audioData());
}
}
}
}
@@ -1477,6 +1481,10 @@ void Reflector::udpDatagramReceived(const IpAddress& addr, uint16_t port,
{
kv.second->onParentFlush(tg);
}
if (m_twin_link != nullptr)
{
m_twin_link->onLocalFlush(tg);
}
}
}
// To be 100% correct the reflector should wait for all connected
@@ -1629,6 +1637,13 @@ void Reflector::onTalkerUpdated(uint32_t tg, ReflectorClient* old_talker,
kv.second->onParentTalkerStop(tg);
}
}
// Notify twin partner about local talker changes.
if (m_twin_link != nullptr)
{
std::string callsign = (new_talker != nullptr) ? new_talker->callsign()
: "";
m_twin_link->onLocalTalkerUpdated(tg, callsign);
}
}
} /* Reflector::onTalkerUpdated */