From 02853e74ba7b53a42b87cdaeb8c72e02194c691e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 12 Sep 2024 21:52:27 -0500 Subject: [PATCH] Reduce the bitrate to YUV420 defaults if YUV444 was selected but not negotiated If the user has selected a custom bitrate, we will leave it alone. --- app/streaming/session.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index aeff8f2b..6dbc225f 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -1584,6 +1584,24 @@ bool Session::startConnectionAsync() } } + // If the user has chosen YUV444 without adjusting the bitrate but the host doesn't + // support YUV444 streaming, use the default non-444 bitrate for the stream instead. + // This should provide equivalent image quality for YUV420 as the stream would have + // had if the host supported YUV444 (though obviously with 4:2:0 subsampling). + // If the user has adjusted the bitrate from default, we'll assume they really wanted + // that value and not second guess them. + if (m_Preferences->enableYUV444 && + !(m_StreamConfig.supportedVideoFormats & VIDEO_FORMAT_MASK_YUV444) && + m_StreamConfig.bitrate == StreamingPreferences::getDefaultBitrate(m_StreamConfig.width, + m_StreamConfig.height, + m_StreamConfig.fps, + true)) { + m_StreamConfig.bitrate = StreamingPreferences::getDefaultBitrate(m_StreamConfig.width, + m_StreamConfig.height, + m_StreamConfig.fps, + false); + } + int err = LiStartConnection(&hostInfo, &m_StreamConfig, &k_ConnCallbacks, &m_VideoCallbacks, &m_AudioCallbacks, NULL, 0, NULL, 0);