diff options
| author | Techjar <tecknojar@gmail.com> | 2018-07-08 01:51:30 -0400 |
|---|---|---|
| committer | Techjar <tecknojar@gmail.com> | 2018-07-08 02:18:17 -0400 |
| commit | 98447eae646b3f77834cc10fda2eff51e777bc30 (patch) | |
| tree | d5f425cd6ff596bfe33a4a17f68c189a21d5debc /Source | |
| parent | 7b986c1b54eac4aac972e24bd4a9d81b8ee746a1 (diff) | |
NetPlay: Send timebase packet less frequently
This packet is only used by the host to detect desyncs, and we don't really need to know the exact frame we desynced on (unless you're debugging, but you can just recompile for that), so it's perfectly fine to just send it less often. This makes it so the timebase packet is sent only every 60 frames, rather than every frame, which further cuts back on unnecessary bandwidth consumption.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/NetPlayClient.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index be937c5299..085e8b1849 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -1236,15 +1236,20 @@ void NetPlayClient::SendTimeBase() { std::lock_guard<std::mutex> lk(crit_netplay_client); - u64 timebase = SystemTimers::GetFakeTimeBase(); + if (netplay_client->m_timebase_frame % 60 == 0) + { + u64 timebase = SystemTimers::GetFakeTimeBase(); - sf::Packet packet; - packet << static_cast<MessageId>(NP_MSG_TIMEBASE); - packet << static_cast<u32>(timebase); - packet << static_cast<u32>(timebase << 32); - packet << netplay_client->m_timebase_frame++; + sf::Packet packet; + packet << static_cast<MessageId>(NP_MSG_TIMEBASE); + packet << static_cast<u32>(timebase); + packet << static_cast<u32>(timebase << 32); + packet << netplay_client->m_timebase_frame; + + netplay_client->SendAsync(std::move(packet)); + } - netplay_client->SendAsync(std::move(packet)); + netplay_client->m_timebase_frame++; } bool NetPlayClient::DoAllPlayersHaveGame() |
