Skip to content

Commit

Permalink
Reduce the bitrate to YUV420 defaults if YUV444 was selected but not …
Browse files Browse the repository at this point in the history
…negotiated

If the user has selected a custom bitrate, we will leave it alone.
  • Loading branch information
cgutman committed Sep 13, 2024
1 parent 46910cf commit 02853e7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/streaming/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 02853e7

Please sign in to comment.