Update to new HDR support option in moonlight-common-c

This commit is contained in:
Cameron Gutman 2023-07-02 23:47:47 -05:00
parent 458460515d
commit f1bcc217a9
7 changed files with 14 additions and 22 deletions

View File

@ -424,13 +424,13 @@ public class Game extends Activity implements SurfaceHolder.Callback,
int supportedVideoFormats = MoonBridge.VIDEO_FORMAT_H264; int supportedVideoFormats = MoonBridge.VIDEO_FORMAT_H264;
if (decoderRenderer.isHevcSupported()) { if (decoderRenderer.isHevcSupported()) {
supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_H265; supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_H265;
if (decoderRenderer.isHevcMain10Hdr10Supported()) { if (willStreamHdr && decoderRenderer.isHevcMain10Hdr10Supported()) {
supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_H265_MAIN10; supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_H265_MAIN10;
} }
} }
if (decoderRenderer.isAv1Supported()) { if (decoderRenderer.isAv1Supported()) {
supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_AV1_MAIN8; supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_AV1_MAIN8;
if (decoderRenderer.isAv1Main10Supported()) { if (willStreamHdr && decoderRenderer.isAv1Main10Supported()) {
supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_AV1_MAIN10; supportedVideoFormats |= MoonBridge.VIDEO_FORMAT_AV1_MAIN10;
} }
} }
@ -486,7 +486,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
.setHevcBitratePercentageMultiplier(75) .setHevcBitratePercentageMultiplier(75)
.setAv1BitratePercentageMultiplier(60) .setAv1BitratePercentageMultiplier(60)
.setSupportedVideoFormats(supportedVideoFormats) .setSupportedVideoFormats(supportedVideoFormats)
.setEnableHdr(willStreamHdr)
.setAttachedGamepadMask(gamepadMask) .setAttachedGamepadMask(gamepadMask)
.setClientRefreshRateX100((int)(displayRefreshRate * 100)) .setClientRefreshRateX100((int)(displayRefreshRate * 100))
.setAudioConfiguration(prefConfig.audioConfiguration) .setAudioConfiguration(prefConfig.audioConfiguration)

View File

@ -19,6 +19,7 @@ public class ConnectionContext {
// This is the version quad from the appversion tag of /serverinfo // This is the version quad from the appversion tag of /serverinfo
public String serverAppVersion; public String serverAppVersion;
public String serverGfeVersion; public String serverGfeVersion;
public int serverCodecModeSupport;
// This is the sessionUrl0 tag from /resume and /launch // This is the sessionUrl0 tag from /resume and /launch
public String rtspSessionUrl; public String rtspSessionUrl;

View File

@ -242,9 +242,11 @@ public class NvConnection {
return false; return false;
} }
context.negotiatedHdr = context.streamConfig.getEnableHdr(); context.serverCodecModeSupport = (int)h.getServerCodecModeSupport(serverInfo);
if ((h.getServerCodecModeSupport(serverInfo) & 0x200) == 0 && context.negotiatedHdr) {
context.connListener.displayTransientMessage("Your GPU does not support streaming HDR. The stream will be SDR."); context.negotiatedHdr = (context.streamConfig.getSupportedVideoFormats() & MoonBridge.VIDEO_FORMAT_MASK_10BIT) != 0;
if ((context.serverCodecModeSupport & 0x20200) == 0 && context.negotiatedHdr) {
context.connListener.displayTransientMessage("Your PC GPU does not support streaming HDR. The stream will be SDR.");
context.negotiatedHdr = false; context.negotiatedHdr = false;
} }
@ -254,7 +256,7 @@ public class NvConnection {
// Check for a supported stream resolution // Check for a supported stream resolution
if ((context.streamConfig.getWidth() > 4096 || context.streamConfig.getHeight() > 4096) && if ((context.streamConfig.getWidth() > 4096 || context.streamConfig.getHeight() > 4096) &&
(h.getServerCodecModeSupport(serverInfo) & 0x200) == 0) { (h.getServerCodecModeSupport(serverInfo) & 0x200) == 0 && context.isNvidiaServerSoftware) {
context.connListener.displayMessage("Your host PC does not support streaming at resolutions above 4K."); context.connListener.displayMessage("Your host PC does not support streaming at resolutions above 4K.");
return false; return false;
} }
@ -430,7 +432,7 @@ public class NvConnection {
context.negotiatedPacketSize, context.negotiatedRemoteStreaming, context.negotiatedPacketSize, context.negotiatedRemoteStreaming,
context.streamConfig.getAudioConfiguration().toInt(), context.streamConfig.getAudioConfiguration().toInt(),
context.streamConfig.getSupportedVideoFormats(), context.streamConfig.getSupportedVideoFormats(),
context.negotiatedHdr, context.serverCodecModeSupport,
context.streamConfig.getHevcBitratePercentageMultiplier(), context.streamConfig.getHevcBitratePercentageMultiplier(),
context.streamConfig.getAv1BitratePercentageMultiplier(), context.streamConfig.getAv1BitratePercentageMultiplier(),
context.streamConfig.getClientRefreshRateX100(), context.streamConfig.getClientRefreshRateX100(),

View File

@ -25,7 +25,6 @@ public class StreamConfiguration {
private int supportedVideoFormats; private int supportedVideoFormats;
private int hevcBitratePercentageMultiplier; private int hevcBitratePercentageMultiplier;
private int av1BitratePercentageMultiplier; private int av1BitratePercentageMultiplier;
private boolean enableHdr;
private int attachedGamepadMask; private int attachedGamepadMask;
private int encryptionFlags; private int encryptionFlags;
private int colorRange; private int colorRange;
@ -96,11 +95,6 @@ public class StreamConfiguration {
return this; return this;
} }
public StreamConfiguration.Builder setEnableHdr(boolean enableHdr) {
config.enableHdr = enableHdr;
return this;
}
public StreamConfiguration.Builder setAttachedGamepadMask(int attachedGamepadMask) { public StreamConfiguration.Builder setAttachedGamepadMask(int attachedGamepadMask) {
config.attachedGamepadMask = attachedGamepadMask; config.attachedGamepadMask = attachedGamepadMask;
return this; return this;
@ -238,10 +232,6 @@ public class StreamConfiguration {
return av1BitratePercentageMultiplier; return av1BitratePercentageMultiplier;
} }
public boolean getEnableHdr() {
return enableHdr;
}
public int getAttachedGamepadMask() { public int getAttachedGamepadMask() {
return attachedGamepadMask; return attachedGamepadMask;
} }

View File

@ -346,7 +346,7 @@ public class MoonBridge {
int width, int height, int fps, int width, int height, int fps,
int bitrate, int packetSize, int streamingRemotely, int bitrate, int packetSize, int streamingRemotely,
int audioConfiguration, int supportedVideoFormats, int audioConfiguration, int supportedVideoFormats,
boolean enableHdr, int serverCodecModeSupport,
int hevcBitratePercentageMultiplier, int hevcBitratePercentageMultiplier,
int av1BitratePercentageMultiplier, int av1BitratePercentageMultiplier,
int clientRefreshRateX100, int clientRefreshRateX100,

View File

@ -433,7 +433,7 @@ Java_com_limelight_nvstream_jni_MoonBridge_startConnection(JNIEnv *env, jclass c
jint width, jint height, jint fps, jint width, jint height, jint fps,
jint bitrate, jint packetSize, jint streamingRemotely, jint bitrate, jint packetSize, jint streamingRemotely,
jint audioConfiguration, jint supportedVideoFormats, jint audioConfiguration, jint supportedVideoFormats,
jboolean enableHdr, jint serverCodecModeSupport,
jint hevcBitratePercentageMultiplier, jint hevcBitratePercentageMultiplier,
jint av1BitratePercentageMultiplier, jint av1BitratePercentageMultiplier,
jint clientRefreshRateX100, jint clientRefreshRateX100,
@ -456,7 +456,7 @@ Java_com_limelight_nvstream_jni_MoonBridge_startConnection(JNIEnv *env, jclass c
.streamingRemotely = streamingRemotely, .streamingRemotely = streamingRemotely,
.audioConfiguration = audioConfiguration, .audioConfiguration = audioConfiguration,
.supportedVideoFormats = supportedVideoFormats, .supportedVideoFormats = supportedVideoFormats,
.enableHdr = enableHdr, .serverCodecModeSupport = serverCodecModeSupport,
.hevcBitratePercentageMultiplier = hevcBitratePercentageMultiplier, .hevcBitratePercentageMultiplier = hevcBitratePercentageMultiplier,
.av1BitratePercentageMultiplier = av1BitratePercentageMultiplier, .av1BitratePercentageMultiplier = av1BitratePercentageMultiplier,
.clientRefreshRateX100 = clientRefreshRateX100, .clientRefreshRateX100 = clientRefreshRateX100,

@ -1 +1 @@
Subproject commit e36bde4acce48c21c79a57fb29727d96fdae6503 Subproject commit effba1a16fab4f72ac52e14b99bb90c08b96b582