mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-02-16 02:20:53 +00:00
Add network latency to stats overlay
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
#import "HttpRequest.h"
|
#import "HttpRequest.h"
|
||||||
#import "IdManager.h"
|
#import "IdManager.h"
|
||||||
|
|
||||||
|
#include <Limelight.h>
|
||||||
|
|
||||||
@implementation StreamManager {
|
@implementation StreamManager {
|
||||||
StreamConfiguration* _config;
|
StreamConfiguration* _config;
|
||||||
|
|
||||||
@@ -151,13 +153,23 @@
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t rtt, variance;
|
||||||
|
NSString* latencyString;
|
||||||
|
if (LiGetEstimatedRttInfo(&rtt, &variance)) {
|
||||||
|
latencyString = [NSString stringWithFormat:@"%u ms (variance: %u ms)", rtt, variance];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
latencyString = @"N/A";
|
||||||
|
}
|
||||||
|
|
||||||
float interval = stats.endTime - stats.startTime;
|
float interval = stats.endTime - stats.startTime;
|
||||||
return [NSString stringWithFormat:@"Video stream: %dx%d %.2f FPS (Codec: %@)\nFrames dropped by your network connection: %.2f%%\n",
|
return [NSString stringWithFormat:@"Video stream: %dx%d %.2f FPS (Codec: %@)\nFrames dropped by your network connection: %.2f%%\nAverage network latency: %@",
|
||||||
_config.width,
|
_config.width,
|
||||||
_config.height,
|
_config.height,
|
||||||
stats.totalFrames / interval,
|
stats.totalFrames / interval,
|
||||||
[_connection getActiveCodecName],
|
[_connection getActiveCodecName],
|
||||||
stats.networkDroppedFrames / interval];
|
stats.networkDroppedFrames / interval,
|
||||||
|
latencyString];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user