mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
Fix streaming from Gen 3 servers
This commit is contained in:
parent
801aaf43d6
commit
6245934462
@ -271,6 +271,15 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
|
|||||||
err |= addGen5Options(&optionHead);
|
err |= addGen5Options(&optionHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StreamConfig.audioConfiguration == AUDIO_CONFIGURATION_51_SURROUND) {
|
||||||
|
audioChannelCount = CHANNEL_COUNT_51_SURROUND;
|
||||||
|
audioChannelMask = CHANNEL_MASK_51_SURROUND;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
audioChannelCount = CHANNEL_COUNT_STEREO;
|
||||||
|
audioChannelMask = CHANNEL_MASK_STEREO;
|
||||||
|
}
|
||||||
|
|
||||||
if (AppVersionQuad[0] >= 4) {
|
if (AppVersionQuad[0] >= 4) {
|
||||||
unsigned char slicesPerFrame;
|
unsigned char slicesPerFrame;
|
||||||
|
|
||||||
@ -337,15 +346,6 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
|
|||||||
sprintf(payloadStr, "%d", StreamConfig.clientRefreshRateX100);
|
sprintf(payloadStr, "%d", StreamConfig.clientRefreshRateX100);
|
||||||
err |= addAttributeString(&optionHead, "x-nv-video[0].clientRefreshRateX100", payloadStr);
|
err |= addAttributeString(&optionHead, "x-nv-video[0].clientRefreshRateX100", payloadStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StreamConfig.audioConfiguration == AUDIO_CONFIGURATION_51_SURROUND) {
|
|
||||||
audioChannelCount = CHANNEL_COUNT_51_SURROUND;
|
|
||||||
audioChannelMask = CHANNEL_MASK_51_SURROUND;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
audioChannelCount = CHANNEL_COUNT_STEREO;
|
|
||||||
audioChannelMask = CHANNEL_MASK_STEREO;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(payloadStr, "%d", audioChannelCount);
|
sprintf(payloadStr, "%d", audioChannelCount);
|
||||||
err |= addAttributeString(&optionHead, "x-nv-audio.surround.numChannels", payloadStr);
|
err |= addAttributeString(&optionHead, "x-nv-audio.surround.numChannels", payloadStr);
|
||||||
@ -357,42 +357,42 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
|
|||||||
else {
|
else {
|
||||||
err |= addAttributeString(&optionHead, "x-nv-audio.surround.enable", "0");
|
err |= addAttributeString(&optionHead, "x-nv-audio.surround.enable", "0");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (AppVersionQuad[0] >= 7) {
|
if (AppVersionQuad[0] >= 7) {
|
||||||
// Decide to use HQ audio based on the original video bitrate, not the HEVC-adjusted value
|
// Decide to use HQ audio based on the original video bitrate, not the HEVC-adjusted value
|
||||||
if (OriginalVideoBitrate >= HIGH_AUDIO_BITRATE_THRESHOLD && audioChannelCount > 2 &&
|
if (OriginalVideoBitrate >= HIGH_AUDIO_BITRATE_THRESHOLD && audioChannelCount > 2 &&
|
||||||
(AudioCallbacks.capabilities & CAPABILITY_SLOW_OPUS_DECODER) == 0) {
|
(AudioCallbacks.capabilities & CAPABILITY_SLOW_OPUS_DECODER) == 0) {
|
||||||
// Enable high quality mode for surround sound
|
// Enable high quality mode for surround sound
|
||||||
err |= addAttributeString(&optionHead, "x-nv-audio.surround.AudioQuality", "1");
|
err |= addAttributeString(&optionHead, "x-nv-audio.surround.AudioQuality", "1");
|
||||||
|
|
||||||
// Let the audio stream code know that it needs to disable coupled streams when
|
// Let the audio stream code know that it needs to disable coupled streams when
|
||||||
// decoding this audio stream.
|
// decoding this audio stream.
|
||||||
HighQualitySurroundEnabled = 1;
|
HighQualitySurroundEnabled = 1;
|
||||||
|
|
||||||
// Use 5 ms frames since we don't have a slow decoder
|
// Use 5 ms frames since we don't have a slow decoder
|
||||||
|
AudioPacketDuration = 5;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
err |= addAttributeString(&optionHead, "x-nv-audio.surround.AudioQuality", "0");
|
||||||
|
HighQualitySurroundEnabled = 0;
|
||||||
|
|
||||||
|
if ((AudioCallbacks.capabilities & CAPABILITY_SLOW_OPUS_DECODER) == 0) {
|
||||||
|
// Use 5 ms packets by default for lowest latency
|
||||||
AudioPacketDuration = 5;
|
AudioPacketDuration = 5;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
err |= addAttributeString(&optionHead, "x-nv-audio.surround.AudioQuality", "0");
|
// Use 20 ms packets for slow decoders to save CPU and bandwidth
|
||||||
HighQualitySurroundEnabled = 0;
|
AudioPacketDuration = 20;
|
||||||
|
|
||||||
if ((AudioCallbacks.capabilities & CAPABILITY_SLOW_OPUS_DECODER) == 0) {
|
|
||||||
// Use 5 ms packets by default for lowest latency
|
|
||||||
AudioPacketDuration = 5;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Use 20 ms packets for slow decoders to save CPU and bandwidth
|
|
||||||
AudioPacketDuration = 20;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(payloadStr, "%d", AudioPacketDuration);
|
sprintf(payloadStr, "%d", AudioPacketDuration);
|
||||||
err |= addAttributeString(&optionHead, "x-nv-aqos.packetDuration", payloadStr);
|
err |= addAttributeString(&optionHead, "x-nv-aqos.packetDuration", payloadStr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// 5 ms duration for legacy servers
|
// 5 ms duration for legacy servers
|
||||||
AudioPacketDuration = 5;
|
AudioPacketDuration = 5;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user