mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-30 11:40:32 +00:00
In spectator mode, we should never be ahead of our peer.
This commit is contained in:
parent
3e0bc5acdc
commit
e495671563
@ -303,6 +303,11 @@ static bool netplay_poll(void)
|
||||
break;
|
||||
}
|
||||
|
||||
case NETPLAY_STALL_SPECTATOR_WAIT:
|
||||
if (netplay_data->unread_frame_count > netplay_data->self_frame_count)
|
||||
netplay_data->stall = NETPLAY_STALL_NONE;
|
||||
break;
|
||||
|
||||
case NETPLAY_STALL_INPUT_LATENCY:
|
||||
/* Just let it recalculate momentarily */
|
||||
netplay_data->stall = NETPLAY_STALL_NONE;
|
||||
@ -374,6 +379,16 @@ static bool netplay_poll(void)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* If we're a spectator, are we ahead at all? */
|
||||
if (!netplay_data->is_server &&
|
||||
(netplay_data->self_mode == NETPLAY_CONNECTION_SPECTATING ||
|
||||
netplay_data->self_mode == NETPLAY_CONNECTION_SLAVE) &&
|
||||
netplay_data->unread_frame_count <= netplay_data->self_frame_count)
|
||||
{
|
||||
netplay_data->stall = NETPLAY_STALL_SPECTATOR_WAIT;
|
||||
netplay_data->stall_time = cpu_features_get_time_usec();
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're stalling, consider disconnection */
|
||||
|
@ -215,9 +215,21 @@ enum rarch_netplay_connection_mode
|
||||
enum rarch_netplay_stall_reason
|
||||
{
|
||||
NETPLAY_STALL_NONE = 0,
|
||||
|
||||
/* We're so far ahead that we can't read more data without overflowing the
|
||||
* buffer */
|
||||
NETPLAY_STALL_RUNNING_FAST,
|
||||
|
||||
/* We're in spectator or slave mode and are running ahead at all */
|
||||
NETPLAY_STALL_SPECTATOR_WAIT,
|
||||
|
||||
/* Our actual execution is catching up with latency-adjusted input frames */
|
||||
NETPLAY_STALL_INPUT_LATENCY,
|
||||
|
||||
/* The server asked us to stall */
|
||||
NETPLAY_STALL_SERVER_REQUESTED,
|
||||
|
||||
/* We have no connection and must have one to proceed */
|
||||
NETPLAY_STALL_NO_CONNECTION
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user