Pass RTSP session URL to moonlight-common-c for dynamic ports

This commit is contained in:
Cameron Gutman
2021-07-02 17:31:45 -05:00
parent 295cf61727
commit 7ed6b22cac
5 changed files with 22 additions and 6 deletions

View File

@@ -25,6 +25,7 @@
char _hostString[256];
char _appVersionString[32];
char _gfeVersionString[32];
char _rtspSessionUrl[128];
}
static NSLock* initLock;
@@ -408,6 +409,11 @@ void ClConnectionStatusUpdate(int status)
[config.gfeVersion cStringUsingEncoding:NSUTF8StringEncoding],
sizeof(_gfeVersionString));
}
if (config.rtspSessionUrl != nil) {
strncpy(_rtspSessionUrl,
[config.rtspSessionUrl cStringUsingEncoding:NSUTF8StringEncoding],
sizeof(_rtspSessionUrl));
}
LiInitializeServerInformation(&_serverInfo);
_serverInfo.address = _hostString;
@@ -415,6 +421,9 @@ void ClConnectionStatusUpdate(int status)
if (config.gfeVersion != nil) {
_serverInfo.serverInfoGfeVersion = _gfeVersionString;
}
if (config.rtspSessionUrl != nil) {
_serverInfo.rtspSessionUrl = _rtspSessionUrl;
}
renderer = myRenderer;
_callbacks = callbacks;

View File

@@ -13,6 +13,7 @@
@property NSString* gfeVersion;
@property NSString* appID;
@property NSString* appName;
@property NSString* rtspSessionUrl;
@property int width;
@property int height;
@property int frameRate;

View File

@@ -9,5 +9,5 @@
#import "StreamConfiguration.h"
@implementation StreamConfiguration
@synthesize host, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, appName, optimizeGameSettings, playAudioOnPC, audioConfiguration, enableHdr, multiController, allowHevc, serverCert;
@synthesize host, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, appName, optimizeGameSettings, playAudioOnPC, audioConfiguration, enableHdr, multiController, allowHevc, serverCert, rtspSessionUrl;
@end

View File

@@ -78,18 +78,22 @@
}
// resumeApp and launchApp handle calling launchFailed
NSString* sessionUrl;
if ([serverState hasSuffix:@"_SERVER_BUSY"]) {
// App already running, resume it
if (![self resumeApp:hMan]) {
if (![self resumeApp:hMan receiveSessionUrl:&sessionUrl]) {
return;
}
} else {
// Start app
if (![self launchApp:hMan]) {
if (![self launchApp:hMan receiveSessionUrl:&sessionUrl]) {
return;
}
}
// Populate RTSP session URL from launch/resume response
_config.rtspSessionUrl = sessionUrl;
// Populate the config's version fields from serverinfo
_config.appVersion = appversion;
_config.gfeVersion = gfeVersion;
@@ -108,7 +112,7 @@
[_connection terminate];
}
- (BOOL) launchApp:(HttpManager*)hMan {
- (BOOL) launchApp:(HttpManager*)hMan receiveSessionUrl:(NSString**)sessionUrl {
HttpResponse* launchResp = [[HttpResponse alloc] init];
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:launchResp withUrlRequest:[hMan newLaunchRequest:_config]]];
NSString *gameSession = [launchResp getStringTag:@"gamesession"];
@@ -122,10 +126,11 @@
return FALSE;
}
*sessionUrl = [launchResp getStringTag:@"sessionUrl0"];
return TRUE;
}
- (BOOL) resumeApp:(HttpManager*)hMan {
- (BOOL) resumeApp:(HttpManager*)hMan receiveSessionUrl:(NSString**)sessionUrl {
HttpResponse* resumeResp = [[HttpResponse alloc] init];
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:resumeResp withUrlRequest:[hMan newResumeRequest:_config]]];
NSString* resume = [resumeResp getStringTag:@"resume"];
@@ -139,6 +144,7 @@
return FALSE;
}
*sessionUrl = [resumeResp getStringTag:@"sessionUrl0"];
return TRUE;
}