mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-23 08:47:02 +00:00
Plumb several new options into stream config and launch requests: optimizeGameSettings, playAudioOnPC, surround sound, and HDR
This commit is contained in:
@@ -90,7 +90,9 @@ int ArInit(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, v
|
||||
// Clear the circular buffer
|
||||
audioBufferWriteIndex = audioBufferReadIndex = 0;
|
||||
|
||||
// We only support stereo for now
|
||||
// We only support stereo for now.
|
||||
// TODO: Ensure AudioToolbox's channel mapping matches Opus's
|
||||
// and correct if neccessary.
|
||||
assert(audioConfiguration == AUDIO_CONFIGURATION_STEREO);
|
||||
|
||||
activeChannelCount = opusConfig->channelCount;
|
||||
@@ -281,9 +283,20 @@ void ClLogMessage(const char* format, ...)
|
||||
_streamConfig.height = config.height;
|
||||
_streamConfig.fps = config.frameRate;
|
||||
_streamConfig.bitrate = config.bitRate;
|
||||
|
||||
// This will activate the remote streaming optimization in moonlight-common if needed
|
||||
_streamConfig.streamingRemotely = config.streamingRemotely;
|
||||
_streamConfig.enableHdr = config.enableHdr;
|
||||
|
||||
switch (config.audioChannelCount) {
|
||||
case 2:
|
||||
_streamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
||||
break;
|
||||
case 6:
|
||||
_streamConfig.audioConfiguration = AUDIO_CONFIGURATION_51_SURROUND;
|
||||
break;
|
||||
default:
|
||||
Log(LOG_E, @"Unknown audio channel count: %d", config.audioChannelCount);
|
||||
abort();
|
||||
}
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
// On iOS 11, we can use HEVC if the server supports encoding it
|
||||
@@ -302,6 +315,9 @@ void ClLogMessage(const char* format, ...)
|
||||
}
|
||||
#endif
|
||||
|
||||
// HEVC must be supported when HDR is enabled
|
||||
assert(!_streamConfig.enableHdr || _streamConfig.supportsHevc);
|
||||
|
||||
// Use some of the HEVC encoding efficiency improvements to
|
||||
// reduce bandwidth usage while still gaining some image
|
||||
// quality improvement.
|
||||
|
||||
@@ -21,5 +21,10 @@
|
||||
@property int streamingRemotely;
|
||||
@property NSData* riKey;
|
||||
@property int gamepadMask;
|
||||
@property BOOL optimizeGameSettings;
|
||||
@property BOOL playAudioOnPC;
|
||||
@property int audioChannelCount;
|
||||
@property int audioChannelMask;
|
||||
@property BOOL enableHdr;
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
#import "StreamConfiguration.h"
|
||||
|
||||
@implementation StreamConfiguration
|
||||
@synthesize host, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, streamingRemotely, appName;
|
||||
@synthesize host, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, streamingRemotely, appName, optimizeGameSettings, playAudioOnPC, audioChannelMask, audioChannelCount, enableHdr;
|
||||
@end
|
||||
|
||||
@@ -104,14 +104,7 @@
|
||||
|
||||
- (BOOL) launchApp:(HttpManager*)hMan {
|
||||
HttpResponse* launchResp = [[HttpResponse alloc] init];
|
||||
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:launchResp withUrlRequest:
|
||||
[hMan newLaunchRequest:_config.appID
|
||||
width:_config.width
|
||||
height:_config.height
|
||||
refreshRate:_config.frameRate
|
||||
rikey:[Utils bytesToHex:_config.riKey]
|
||||
rikeyid:_config.riKeyId
|
||||
gamepadMask:_config.gamepadMask]]];
|
||||
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:launchResp withUrlRequest:[hMan newLaunchRequest:_config]]];
|
||||
NSString *gameSession = [launchResp getStringTag:@"gamesession"];
|
||||
if (launchResp == NULL || ![launchResp isStatusOk]) {
|
||||
[_callbacks launchFailed:@"Failed to launch app"];
|
||||
@@ -128,9 +121,7 @@
|
||||
|
||||
- (BOOL) resumeApp:(HttpManager*)hMan {
|
||||
HttpResponse* resumeResp = [[HttpResponse alloc] init];
|
||||
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:resumeResp withUrlRequest:
|
||||
[hMan newResumeRequestWithRiKey:[Utils bytesToHex:_config.riKey]
|
||||
riKeyId:_config.riKeyId]]];
|
||||
[hMan executeRequestSynchronously:[HttpRequest requestForResponse:resumeResp withUrlRequest:[hMan newResumeRequest:_config]]];
|
||||
NSString* resume = [resumeResp getStringTag:@"resume"];
|
||||
if (resumeResp == NULL || ![resumeResp isStatusOk]) {
|
||||
[_callbacks launchFailed:@"Failed to resume app"];
|
||||
|
||||
Reference in New Issue
Block a user