mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 14:21:30 +00:00
Fix channel mapping error in 5.1 high quality mode
This commit is contained in:
+18
-10
@@ -42,9 +42,12 @@ static OPUS_MULTISTREAM_CONFIGURATION opus51SurroundConfig = {
|
|||||||
.mapping = {0, 4, 1, 5, 2, 3}
|
.mapping = {0, 4, 1, 5, 2, 3}
|
||||||
};
|
};
|
||||||
|
|
||||||
static POPUS_MULTISTREAM_CONFIGURATION opusConfigArray[] = {
|
static OPUS_MULTISTREAM_CONFIGURATION opus51HighSurroundConfig = {
|
||||||
&opusStereoConfig,
|
.sampleRate = SAMPLE_RATE,
|
||||||
&opus51SurroundConfig,
|
.channelCount = 6,
|
||||||
|
.streams = 6,
|
||||||
|
.coupledStreams = 0,
|
||||||
|
.mapping = {0, 1, 2, 3, 4, 5}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _QUEUED_AUDIO_PACKET {
|
typedef struct _QUEUED_AUDIO_PACKET {
|
||||||
@@ -282,16 +285,21 @@ void stopAudioStream(void) {
|
|||||||
|
|
||||||
int startAudioStream(void* audioContext, int arFlags) {
|
int startAudioStream(void* audioContext, int arFlags) {
|
||||||
int err;
|
int err;
|
||||||
OPUS_MULTISTREAM_CONFIGURATION chosenConfig;
|
POPUS_MULTISTREAM_CONFIGURATION chosenConfig;
|
||||||
|
|
||||||
memcpy(&chosenConfig, opusConfigArray[StreamConfig.audioConfiguration], sizeof(chosenConfig));
|
if (StreamConfig.audioConfiguration == AUDIO_CONFIGURATION_STEREO) {
|
||||||
if (HighQualitySurroundEnabled) {
|
chosenConfig = &opusStereoConfig;
|
||||||
// With high quality mode enabled, the encoder stops using coupled streams
|
}
|
||||||
chosenConfig.coupledStreams = 0;
|
else if (StreamConfig.audioConfiguration == AUDIO_CONFIGURATION_51_SURROUND) {
|
||||||
chosenConfig.streams = chosenConfig.channelCount;
|
if (HighQualitySurroundEnabled) {
|
||||||
|
chosenConfig = &opus51HighSurroundConfig;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
chosenConfig = &opus51SurroundConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = AudioCallbacks.init(StreamConfig.audioConfiguration, &chosenConfig, audioContext, arFlags);
|
err = AudioCallbacks.init(StreamConfig.audioConfiguration, chosenConfig, audioContext, arFlags);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user