Add support for requesting 20 ms audio frames for slow Opus decoders

This commit is contained in:
Cameron Gutman committed 2019-05-04 15:33:48 -07:00
1 parent 1154cb1d3d
commit 59481c085a
5 files changed
+30 -6

No files matched your search

+19
View File
@@ -368,11 +368,30 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
// Let the audio stream code know that it needs to disable coupled streams when
// decoding this audio stream.
HighQualitySurroundEnabled = 1;
// 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;
}
else {
// Use 20 ms packets for slow decoders to save CPU and bandwidth
AudioPacketDuration = 20;
}
}
sprintf(payloadStr, "%d", AudioPacketDuration);
err |= addAttributeString(&optionHead, "x-nv-aqos.packetDuration", payloadStr);
}
else {
// 5 ms duration for legacy servers
AudioPacketDuration = 5;
}
}