Save RTT in VIDEO_STATS so it can be logged on disconnect

This commit is contained in:
Cameron Gutman 2021-05-22 13:57:12 -05:00
parent ebe9356937
commit e45a60f2ed
2 changed files with 14 additions and 3 deletions

View file

@ -19,6 +19,8 @@ typedef struct _VIDEO_STATS {
uint32_t totalDecodeTime;
uint32_t totalPacerTime;
uint32_t totalRenderTime;
uint32_t lastRtt;
uint32_t lastRttVariance;
float totalFps;
float receivedFps;
float decodedFps;

View file

@ -418,6 +418,16 @@ void FFmpegVideoDecoder::addVideoStats(VIDEO_STATS& src, VIDEO_STATS& dst)
dst.totalPacerTime += src.totalPacerTime;
dst.totalRenderTime += src.totalRenderTime;
if (!LiGetEstimatedRttInfo(&dst.lastRtt, &dst.lastRttVariance)) {
dst.lastRtt = 0;
dst.lastRttVariance = 0;
}
else {
// Our logic to determine if RTT is valid depends on us never
// getting an RTT of 0. ENet currently ensures RTTs are >= 1.
SDL_assert(dst.lastRtt > 0);
}
Uint32 now = SDL_GetTicks();
// Initialize the measurement start point if this is the first video stat window
@ -482,11 +492,10 @@ void FFmpegVideoDecoder::stringifyVideoStats(VIDEO_STATS& stats, char* output)
}
if (stats.renderedFrames != 0) {
uint32_t rtt, variance;
char rttString[32];
if (LiGetEstimatedRttInfo(&rtt, &variance)) {
sprintf(rttString, "%u ms (variance: %u ms)", rtt, variance);
if (stats.lastRtt != 0) {
sprintf(rttString, "%u ms (variance: %u ms)", stats.lastRtt, stats.lastRttVariance);
}
else {
sprintf(rttString, "N/A");