mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2025-07-01 23:35:59 +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.optimizeGameSettings ? 1 : 0,
|
||||
[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,
|
||||
SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(config.audioConfiguration),
|
||||
config.gamepadMask, config.gamepadMask,
|
||||
|
@ -358,19 +358,19 @@ void ClSetMotionEventState(uint16_t controllerNumber, uint8_t motionType, uint16
|
||||
NSString *rawAddress = [Utils addressPortStringToAddress:config.host];
|
||||
strncpy(_hostString,
|
||||
[rawAddress cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
sizeof(_hostString));
|
||||
sizeof(_hostString) - 1);
|
||||
strncpy(_appVersionString,
|
||||
[config.appVersion cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
sizeof(_appVersionString));
|
||||
sizeof(_appVersionString) - 1);
|
||||
if (config.gfeVersion != nil) {
|
||||
strncpy(_gfeVersionString,
|
||||
[config.gfeVersion cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
sizeof(_gfeVersionString));
|
||||
sizeof(_gfeVersionString) - 1);
|
||||
}
|
||||
if (config.rtspSessionUrl != nil) {
|
||||
strncpy(_rtspSessionUrl,
|
||||
[config.rtspSessionUrl cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
sizeof(_rtspSessionUrl));
|
||||
sizeof(_rtspSessionUrl) - 1);
|
||||
}
|
||||
|
||||
LiInitializeServerInformation(&_serverInfo);
|
||||
@ -382,6 +382,7 @@ void ClSetMotionEventState(uint16_t controllerNumber, uint8_t motionType, uint16
|
||||
if (config.rtspSessionUrl != nil) {
|
||||
_serverInfo.rtspSessionUrl = _rtspSessionUrl;
|
||||
}
|
||||
_serverInfo.serverCodecModeSupport = config.serverCodecModeSupport;
|
||||
|
||||
renderer = myRenderer;
|
||||
_callbacks = callbacks;
|
||||
@ -391,17 +392,18 @@ void ClSetMotionEventState(uint16_t controllerNumber, uint8_t motionType, uint16
|
||||
_streamConfig.height = config.height;
|
||||
_streamConfig.fps = config.frameRate;
|
||||
_streamConfig.bitrate = config.bitRate;
|
||||
_streamConfig.enableHdr = config.enableHdr;
|
||||
_streamConfig.supportedVideoFormats = config.supportedVideoFormats;
|
||||
_streamConfig.audioConfiguration = config.audioConfiguration;
|
||||
|
||||
// TODO: If/when video encryption is added, we'll probably want to
|
||||
// limit that to devices that support the ARMv8 AES instructions.
|
||||
_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
|
||||
// quality improvement.
|
||||
_streamConfig.hevcBitratePercentageMultiplier = 75;
|
||||
_streamConfig.av1BitratePercentageMultiplier = 65;
|
||||
|
||||
if ([Utils isActiveNetworkVPN]) {
|
||||
// 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.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]);
|
||||
memset(_streamConfig.remoteInputAesIv, 0, 16);
|
||||
|
@ -15,6 +15,7 @@
|
||||
@property NSString* appID;
|
||||
@property NSString* appName;
|
||||
@property NSString* rtspSessionUrl;
|
||||
@property int serverCodecModeSupport;
|
||||
@property int width;
|
||||
@property int height;
|
||||
@property int frameRate;
|
||||
@ -26,9 +27,8 @@
|
||||
@property BOOL playAudioOnPC;
|
||||
@property BOOL swapABXYButtons;
|
||||
@property int audioConfiguration;
|
||||
@property BOOL enableHdr;
|
||||
@property int supportedVideoFormats;
|
||||
@property BOOL multiController;
|
||||
@property BOOL allowHevc;
|
||||
@property BOOL useFramePacing;
|
||||
@property NSData* serverCert;
|
||||
|
||||
|
@ -9,5 +9,5 @@
|
||||
#import "StreamConfiguration.h"
|
||||
|
||||
@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
|
||||
|
@ -637,7 +637,6 @@ static NSMutableSet* hostList;
|
||||
_streamConfig.bitRate = [streamSettings.bitrate intValue];
|
||||
_streamConfig.optimizeGameSettings = streamSettings.optimizeGames;
|
||||
_streamConfig.playAudioOnPC = streamSettings.playAudioOnPC;
|
||||
_streamConfig.allowHevc = streamSettings.useHevc;
|
||||
_streamConfig.useFramePacing = streamSettings.useFramePacing;
|
||||
_streamConfig.swapABXYButtons = streamSettings.swapABXYButtons;
|
||||
|
||||
@ -661,17 +660,19 @@ static NSMutableSet* hostList;
|
||||
_streamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
||||
}
|
||||
|
||||
// HDR requires HDR10 display and HEVC Main10 decoder on the client.
|
||||
// It additionally requires an HEVC Main10 encoder on the server (GTX 1000+).
|
||||
//
|
||||
// It should also be a user preference, since some games may require higher peak
|
||||
// brightness than the iOS device can support to look correct in HDR mode.
|
||||
if (@available(iOS 11.3, tvOS 11.2, *)) {
|
||||
_streamConfig.enableHdr =
|
||||
(app.host.serverCodecModeSupport & 0x200) != 0 && // HEVC Main10 encoding on host PC GPU
|
||||
VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC) && // Decoder supported
|
||||
(AVPlayer.availableHDRModes & AVPlayerHDRModeHDR10) != 0 && // Display supported
|
||||
streamSettings.enableHdr; // User wants it enabled
|
||||
_streamConfig.serverCodecModeSupport = app.host.serverCodecModeSupport;
|
||||
|
||||
// H.264 is always supported
|
||||
_streamConfig.supportedVideoFormats = VIDEO_FORMAT_H264;
|
||||
|
||||
// HEVC is supported if the user wants it (or it's required by the chosen resolution) and the SoC supports it
|
||||
if ((_streamConfig.width > 4096 || _streamConfig.height > 4096 || streamSettings.useHevc || streamSettings.enableHdr) && VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {
|
||||
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265;
|
||||
|
||||
// HEVC Main10 is supported if the user wants it and the display supports it
|
||||
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