Skip packet compression on Voice packets
cause 99% of the data is already compressed by Opus
This commit is contained in:
parent
b318e981e3
commit
856e93be3f
@ -921,7 +921,7 @@ void ClientApplication::updateRunning(float dt) {
|
|||||||
std::string_view signatureView((char*)signature.data(), signature.size());
|
std::string_view signatureView((char*)signature.data(), signature.size());
|
||||||
std::string_view audioDataView(voiceData.ptr(), voiceData.size());
|
std::string_view audioDataView(voiceData.ptr(), voiceData.size());
|
||||||
auto broadcast = strf("data\0voice\0{}{}"s, signatureView, audioDataView);
|
auto broadcast = strf("data\0voice\0{}{}"s, signatureView, audioDataView);
|
||||||
worldClient->sendSecretBroadcast(broadcast, true);
|
worldClient->sendSecretBroadcast(broadcast, true, false); // Already compressed by Opus.
|
||||||
}
|
}
|
||||||
if (auto mainPlayer = m_universeClient->mainPlayer()) {
|
if (auto mainPlayer = m_universeClient->mainPlayer()) {
|
||||||
auto localSpeaker = m_voice->localSpeaker();
|
auto localSpeaker = m_voice->localSpeaker();
|
||||||
|
@ -2013,7 +2013,7 @@ void WorldClient::connectWire(WireConnection const& output, WireConnection const
|
|||||||
m_outgoingPackets.append(make_shared<ConnectWirePacket>(output, input));
|
m_outgoingPackets.append(make_shared<ConnectWirePacket>(output, input));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WorldClient::sendSecretBroadcast(StringView broadcast, bool raw) {
|
bool WorldClient::sendSecretBroadcast(StringView broadcast, bool raw, bool compress) {
|
||||||
if (!inWorld() || !m_mainPlayer || !m_mainPlayer->getSecretPropertyView(SECRET_BROADCAST_PUBLIC_KEY))
|
if (!inWorld() || !m_mainPlayer || !m_mainPlayer->getSecretPropertyView(SECRET_BROADCAST_PUBLIC_KEY))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2030,6 +2030,9 @@ bool WorldClient::sendSecretBroadcast(StringView broadcast, bool raw) {
|
|||||||
dmg.targetMaterialKind = raw ? broadcast : strf("{}{}{}", SECRET_BROADCAST_PREFIX, StringView((char*)&signature, sizeof(signature)), broadcast);
|
dmg.targetMaterialKind = raw ? broadcast : strf("{}{}{}", SECRET_BROADCAST_PREFIX, StringView((char*)&signature, sizeof(signature)), broadcast);
|
||||||
dmg.position = m_mainPlayer->position();
|
dmg.position = m_mainPlayer->position();
|
||||||
|
|
||||||
|
if (!compress)
|
||||||
|
damageNotification->setCompressionMode(PacketCompressionMode::Disabled);
|
||||||
|
|
||||||
m_outgoingPackets.emplace_back(move(damageNotification));
|
m_outgoingPackets.emplace_back(move(damageNotification));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public:
|
|||||||
// Functions for sending broadcast messages to other players that can receive them,
|
// Functions for sending broadcast messages to other players that can receive them,
|
||||||
// on completely vanilla servers by smuggling it through a DamageNotification.
|
// on completely vanilla servers by smuggling it through a DamageNotification.
|
||||||
// It's cursed as fuck, but it works.
|
// It's cursed as fuck, but it works.
|
||||||
bool sendSecretBroadcast(StringView broadcast, bool raw = false);
|
bool sendSecretBroadcast(StringView broadcast, bool raw = false, bool compress = true);
|
||||||
bool handleSecretBroadcast(PlayerPtr player, StringView broadcast);
|
bool handleSecretBroadcast(PlayerPtr player, StringView broadcast);
|
||||||
|
|
||||||
List<ChatAction> pullPendingChatActions();
|
List<ChatAction> pullPendingChatActions();
|
||||||
|
Loading…
Reference in New Issue
Block a user