Fix audio problems caused by stale HighQualitySurroundSupported and HighQualitySurroundEnabled values

This commit is contained in:
Cameron Gutman 2020-04-02 18:44:13 -07:00
parent 99f22fa7e9
commit d9d2668473
2 changed files with 8 additions and 10 deletions

View File

@ -481,6 +481,7 @@ static int parseOpusConfigFromParamString(char* paramStr, int channelCount, POPU
// Parses the Opus configuration from an RTSP DESCRIBE response // Parses the Opus configuration from an RTSP DESCRIBE response
static int parseOpusConfigurations(PRTSP_MESSAGE response) { static int parseOpusConfigurations(PRTSP_MESSAGE response) {
HighQualitySurroundSupported = 0;
memset(&NormalQualityOpusConfig, 0, sizeof(NormalQualityOpusConfig)); memset(&NormalQualityOpusConfig, 0, sizeof(NormalQualityOpusConfig));
memset(&HighQualityOpusConfig, 0, sizeof(HighQualityOpusConfig)); memset(&HighQualityOpusConfig, 0, sizeof(HighQualityOpusConfig));
@ -547,6 +548,10 @@ static int parseOpusConfigurations(PRTSP_MESSAGE response) {
// It's unknown whether all GFE versions that supported surround sound included these // It's unknown whether all GFE versions that supported surround sound included these
// surround sound parameters. In case they didn't, we'll specifically handle 5.1 surround // surround sound parameters. In case they didn't, we'll specifically handle 5.1 surround
// sound using a hardcoded configuration like we used to before this parsing code existed. // sound using a hardcoded configuration like we used to before this parsing code existed.
//
// It is not necessary to provide HighQualityOpusConfig here because high quality mode
// can only be enabled from seeing the required "surround-params=" value, so there's no
// chance it could regress from implementing this parser.
if (channelCount == 6) { if (channelCount == 6) {
NormalQualityOpusConfig.channelCount = 6; NormalQualityOpusConfig.channelCount = 6;
NormalQualityOpusConfig.streams = 4; NormalQualityOpusConfig.streams = 4;
@ -557,16 +562,6 @@ static int parseOpusConfigurations(PRTSP_MESSAGE response) {
NormalQualityOpusConfig.mapping[3] = 5; NormalQualityOpusConfig.mapping[3] = 5;
NormalQualityOpusConfig.mapping[4] = 2; NormalQualityOpusConfig.mapping[4] = 2;
NormalQualityOpusConfig.mapping[5] = 3; NormalQualityOpusConfig.mapping[5] = 3;
HighQualityOpusConfig.channelCount = 6;
HighQualityOpusConfig.streams = 6;
HighQualityOpusConfig.coupledStreams = 0;
HighQualityOpusConfig.mapping[0] = 0;
HighQualityOpusConfig.mapping[1] = 1;
HighQualityOpusConfig.mapping[2] = 2;
HighQualityOpusConfig.mapping[3] = 3;
HighQualityOpusConfig.mapping[4] = 4;
HighQualityOpusConfig.mapping[5] = 5;
} }
else { else {
// We don't have a hardcoded fallback mapping, so we have no choice but to fail. // We don't have a hardcoded fallback mapping, so we have no choice but to fail.

View File

@ -381,6 +381,9 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
else { else {
// 5 ms duration for legacy servers // 5 ms duration for legacy servers
AudioPacketDuration = 5; AudioPacketDuration = 5;
// High quality audio mode not supported on legacy servers
HighQualitySurroundEnabled = 0;
} }
if (AppVersionQuad[0] >= 7) { if (AppVersionQuad[0] >= 7) {