Rework audio bitrate and quality handling (#642)

This commit is contained in:
Cameron Gutman
2022-12-28 08:30:51 -06:00
committed by GitHub
parent c7fe8f65bd
commit f4a48f44e4
3 changed files with 35 additions and 21 deletions

View File

@@ -646,6 +646,19 @@ void cmd_announce(rtsp_server_t *server, tcp::socket &sock, msg_t &&req) {
return;
}
// When using stereo audio, the audio quality is (strangely) indicated by whether the Host field
// in the RTSP message matches a local interface's IP address. Fortunately, Moonlight always sends
// 0.0.0.0 when it wants low quality, so it is easy to check without enumerating interfaces.
if(config.audio.channels == 2) {
for(auto option = req->options; option != nullptr; option = option->next) {
if("Host"sv == option->option) {
std::string_view content { option->content };
BOOST_LOG(debug) << "Found Host: "sv << content;
config.audio.flags[audio::config_t::HIGH_QUALITY] = (content.find("0.0.0.0"sv) == std::string::npos);
}
}
}
if(config.monitor.videoFormat != 0 && config::video.hevc_mode == 1) {
BOOST_LOG(warning) << "HEVC is disabled, yet the client requested HEVC"sv;