mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-02 15:56:21 +00:00
Update moonlight-common-c
This commit is contained in:
parent
65bf4ca6b1
commit
d1c35144e1
@ -282,7 +282,7 @@
|
|||||||
config.width, config.height, fps,
|
config.width, config.height, fps,
|
||||||
config.optimizeGameSettings ? 1 : 0,
|
config.optimizeGameSettings ? 1 : 0,
|
||||||
[Utils bytesToHex:config.riKey], config.riKeyId,
|
[Utils bytesToHex:config.riKey], config.riKeyId,
|
||||||
config.enableHdr ? @"&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0": @"",
|
(config.supportedVideoFormats & VIDEO_FORMAT_MASK_10BIT) ? @"&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0": @"",
|
||||||
config.playAudioOnPC ? 1 : 0,
|
config.playAudioOnPC ? 1 : 0,
|
||||||
SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(config.audioConfiguration),
|
SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(config.audioConfiguration),
|
||||||
config.gamepadMask, config.gamepadMask,
|
config.gamepadMask, config.gamepadMask,
|
||||||
|
@ -358,19 +358,19 @@ void ClSetMotionEventState(uint16_t controllerNumber, uint8_t motionType, uint16
|
|||||||
NSString *rawAddress = [Utils addressPortStringToAddress:config.host];
|
NSString *rawAddress = [Utils addressPortStringToAddress:config.host];
|
||||||
strncpy(_hostString,
|
strncpy(_hostString,
|
||||||
[rawAddress cStringUsingEncoding:NSUTF8StringEncoding],
|
[rawAddress cStringUsingEncoding:NSUTF8StringEncoding],
|
||||||
sizeof(_hostString));
|
sizeof(_hostString) - 1);
|
||||||
strncpy(_appVersionString,
|
strncpy(_appVersionString,
|
||||||
[config.appVersion cStringUsingEncoding:NSUTF8StringEncoding],
|
[config.appVersion cStringUsingEncoding:NSUTF8StringEncoding],
|
||||||
sizeof(_appVersionString));
|
sizeof(_appVersionString) - 1);
|
||||||
if (config.gfeVersion != nil) {
|
if (config.gfeVersion != nil) {
|
||||||
strncpy(_gfeVersionString,
|
strncpy(_gfeVersionString,
|
||||||
[config.gfeVersion cStringUsingEncoding:NSUTF8StringEncoding],
|
[config.gfeVersion cStringUsingEncoding:NSUTF8StringEncoding],
|
||||||
sizeof(_gfeVersionString));
|
sizeof(_gfeVersionString) - 1);
|
||||||
}
|
}
|
||||||
if (config.rtspSessionUrl != nil) {
|
if (config.rtspSessionUrl != nil) {
|
||||||
strncpy(_rtspSessionUrl,
|
strncpy(_rtspSessionUrl,
|
||||||
[config.rtspSessionUrl cStringUsingEncoding:NSUTF8StringEncoding],
|
[config.rtspSessionUrl cStringUsingEncoding:NSUTF8StringEncoding],
|
||||||
sizeof(_rtspSessionUrl));
|
sizeof(_rtspSessionUrl) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LiInitializeServerInformation(&_serverInfo);
|
LiInitializeServerInformation(&_serverInfo);
|
||||||
@ -382,6 +382,7 @@ void ClSetMotionEventState(uint16_t controllerNumber, uint8_t motionType, uint16
|
|||||||
if (config.rtspSessionUrl != nil) {
|
if (config.rtspSessionUrl != nil) {
|
||||||
_serverInfo.rtspSessionUrl = _rtspSessionUrl;
|
_serverInfo.rtspSessionUrl = _rtspSessionUrl;
|
||||||
}
|
}
|
||||||
|
_serverInfo.serverCodecModeSupport = config.serverCodecModeSupport;
|
||||||
|
|
||||||
renderer = myRenderer;
|
renderer = myRenderer;
|
||||||
_callbacks = callbacks;
|
_callbacks = callbacks;
|
||||||
@ -391,17 +392,18 @@ void ClSetMotionEventState(uint16_t controllerNumber, uint8_t motionType, uint16
|
|||||||
_streamConfig.height = config.height;
|
_streamConfig.height = config.height;
|
||||||
_streamConfig.fps = config.frameRate;
|
_streamConfig.fps = config.frameRate;
|
||||||
_streamConfig.bitrate = config.bitRate;
|
_streamConfig.bitrate = config.bitRate;
|
||||||
_streamConfig.enableHdr = config.enableHdr;
|
_streamConfig.supportedVideoFormats = config.supportedVideoFormats;
|
||||||
_streamConfig.audioConfiguration = config.audioConfiguration;
|
_streamConfig.audioConfiguration = config.audioConfiguration;
|
||||||
|
|
||||||
// TODO: If/when video encryption is added, we'll probably want to
|
// TODO: If/when video encryption is added, we'll probably want to
|
||||||
// limit that to devices that support the ARMv8 AES instructions.
|
// limit that to devices that support the ARMv8 AES instructions.
|
||||||
_streamConfig.encryptionFlags = ENCFLG_AUDIO;
|
_streamConfig.encryptionFlags = ENCFLG_AUDIO;
|
||||||
|
|
||||||
// Use some of the HEVC encoding efficiency improvements to
|
// Use some of the encoding efficiency improvements to
|
||||||
// reduce bandwidth usage while still gaining some image
|
// reduce bandwidth usage while still gaining some image
|
||||||
// quality improvement.
|
// quality improvement.
|
||||||
_streamConfig.hevcBitratePercentageMultiplier = 75;
|
_streamConfig.hevcBitratePercentageMultiplier = 75;
|
||||||
|
_streamConfig.av1BitratePercentageMultiplier = 65;
|
||||||
|
|
||||||
if ([Utils isActiveNetworkVPN]) {
|
if ([Utils isActiveNetworkVPN]) {
|
||||||
// Force remote streaming mode when a VPN is connected
|
// Force remote streaming mode when a VPN is connected
|
||||||
@ -413,30 +415,6 @@ void ClSetMotionEventState(uint16_t controllerNumber, uint8_t motionType, uint16
|
|||||||
_streamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
_streamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
||||||
_streamConfig.packetSize = 1392;
|
_streamConfig.packetSize = 1392;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HDR implies HEVC allowed
|
|
||||||
if (config.enableHdr) {
|
|
||||||
config.allowHevc = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Streaming at resolutions above 4K requires HEVC
|
|
||||||
if (config.width > 4096 || config.height > 4096) {
|
|
||||||
config.allowHevc = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
// On iOS 11, we can use HEVC if the server supports encoding it
|
|
||||||
// and this device has hardware decode for it (A9 and later).
|
|
||||||
// Additionally, iPhone X had a bug which would cause video
|
|
||||||
// to freeze after a few minutes with HEVC prior to iOS 11.3.
|
|
||||||
// As a result, we will only use HEVC on iOS 11.3 or later.
|
|
||||||
if (@available(iOS 11.3, tvOS 11.3, *)) {
|
|
||||||
_streamConfig.supportsHevc =
|
|
||||||
config.allowHevc &&
|
|
||||||
VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC);
|
|
||||||
}
|
|
||||||
|
|
||||||
// HEVC must be supported when HDR is enabled
|
|
||||||
assert(!_streamConfig.enableHdr || _streamConfig.supportsHevc);
|
|
||||||
|
|
||||||
memcpy(_streamConfig.remoteInputAesKey, [config.riKey bytes], [config.riKey length]);
|
memcpy(_streamConfig.remoteInputAesKey, [config.riKey bytes], [config.riKey length]);
|
||||||
memset(_streamConfig.remoteInputAesIv, 0, 16);
|
memset(_streamConfig.remoteInputAesIv, 0, 16);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
@property NSString* appID;
|
@property NSString* appID;
|
||||||
@property NSString* appName;
|
@property NSString* appName;
|
||||||
@property NSString* rtspSessionUrl;
|
@property NSString* rtspSessionUrl;
|
||||||
|
@property int serverCodecModeSupport;
|
||||||
@property int width;
|
@property int width;
|
||||||
@property int height;
|
@property int height;
|
||||||
@property int frameRate;
|
@property int frameRate;
|
||||||
@ -26,9 +27,8 @@
|
|||||||
@property BOOL playAudioOnPC;
|
@property BOOL playAudioOnPC;
|
||||||
@property BOOL swapABXYButtons;
|
@property BOOL swapABXYButtons;
|
||||||
@property int audioConfiguration;
|
@property int audioConfiguration;
|
||||||
@property BOOL enableHdr;
|
@property int supportedVideoFormats;
|
||||||
@property BOOL multiController;
|
@property BOOL multiController;
|
||||||
@property BOOL allowHevc;
|
|
||||||
@property BOOL useFramePacing;
|
@property BOOL useFramePacing;
|
||||||
@property NSData* serverCert;
|
@property NSData* serverCert;
|
||||||
|
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
#import "StreamConfiguration.h"
|
#import "StreamConfiguration.h"
|
||||||
|
|
||||||
@implementation StreamConfiguration
|
@implementation StreamConfiguration
|
||||||
@synthesize host, httpsPort, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, appName, optimizeGameSettings, playAudioOnPC, swapABXYButtons, audioConfiguration, enableHdr, multiController, allowHevc, serverCert, rtspSessionUrl;
|
@synthesize host, httpsPort, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, appName, optimizeGameSettings, playAudioOnPC, swapABXYButtons, audioConfiguration, supportedVideoFormats, multiController, serverCert, rtspSessionUrl, serverCodecModeSupport;
|
||||||
@end
|
@end
|
||||||
|
@ -637,7 +637,6 @@ static NSMutableSet* hostList;
|
|||||||
_streamConfig.bitRate = [streamSettings.bitrate intValue];
|
_streamConfig.bitRate = [streamSettings.bitrate intValue];
|
||||||
_streamConfig.optimizeGameSettings = streamSettings.optimizeGames;
|
_streamConfig.optimizeGameSettings = streamSettings.optimizeGames;
|
||||||
_streamConfig.playAudioOnPC = streamSettings.playAudioOnPC;
|
_streamConfig.playAudioOnPC = streamSettings.playAudioOnPC;
|
||||||
_streamConfig.allowHevc = streamSettings.useHevc;
|
|
||||||
_streamConfig.useFramePacing = streamSettings.useFramePacing;
|
_streamConfig.useFramePacing = streamSettings.useFramePacing;
|
||||||
_streamConfig.swapABXYButtons = streamSettings.swapABXYButtons;
|
_streamConfig.swapABXYButtons = streamSettings.swapABXYButtons;
|
||||||
|
|
||||||
@ -661,17 +660,19 @@ static NSMutableSet* hostList;
|
|||||||
_streamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
_streamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HDR requires HDR10 display and HEVC Main10 decoder on the client.
|
_streamConfig.serverCodecModeSupport = app.host.serverCodecModeSupport;
|
||||||
// It additionally requires an HEVC Main10 encoder on the server (GTX 1000+).
|
|
||||||
//
|
// H.264 is always supported
|
||||||
// It should also be a user preference, since some games may require higher peak
|
_streamConfig.supportedVideoFormats = VIDEO_FORMAT_H264;
|
||||||
// brightness than the iOS device can support to look correct in HDR mode.
|
|
||||||
if (@available(iOS 11.3, tvOS 11.2, *)) {
|
// HEVC is supported if the user wants it (or it's required by the chosen resolution) and the SoC supports it
|
||||||
_streamConfig.enableHdr =
|
if ((_streamConfig.width > 4096 || _streamConfig.height > 4096 || streamSettings.useHevc || streamSettings.enableHdr) && VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {
|
||||||
(app.host.serverCodecModeSupport & 0x200) != 0 && // HEVC Main10 encoding on host PC GPU
|
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265;
|
||||||
VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC) && // Decoder supported
|
|
||||||
(AVPlayer.availableHDRModes & AVPlayerHDRModeHDR10) != 0 && // Display supported
|
// HEVC Main10 is supported if the user wants it and the display supports it
|
||||||
streamSettings.enableHdr; // User wants it enabled
|
if (streamSettings.enableHdr && (AVPlayer.availableHDRModes & AVPlayerHDRModeHDR10) != 0) {
|
||||||
|
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265_MAIN10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit c5dc45e1443363d95b9708de26e86ed57b6946e6
|
Subproject commit c3e9aea84313e28233a66ccaa876ac07d895660b
|
Loading…
x
Reference in New Issue
Block a user