feat(stream)!: remove limit on concurrent sessions and allow quitting apps with active sessions (#3325)

This commit is contained in:
Cameron Gutman
2024-10-24 19:11:50 -05:00
committed by GitHub
parent d2be83fe20
commit 73d777fa0b
11 changed files with 56 additions and 120 deletions

View File

@@ -820,14 +820,6 @@ namespace nvhttp {
response->close_connection_after_response = true;
});
if (rtsp_stream::session_count() == config::stream.channels) {
tree.put("root.resume", 0);
tree.put("root.<xmlattr>.status_code", 503);
tree.put("root.<xmlattr>.status_message", "The host's concurrent stream limit has been reached. Stop an existing stream or increase the 'Channels' value in the Sunshine Web UI.");
return;
}
auto args = request->parse_query_string();
if (
args.find("rikey"s) == std::end(args) ||
@@ -913,16 +905,6 @@ namespace nvhttp {
response->close_connection_after_response = true;
});
// It is possible that due a race condition that this if-statement gives a false negative,
// that is automatically resolved in rtsp_server_t
if (rtsp_stream::session_count() == config::stream.channels) {
tree.put("root.resume", 0);
tree.put("root.<xmlattr>.status_code", 503);
tree.put("root.<xmlattr>.status_message", "The host's concurrent stream limit has been reached. Stop an existing stream or increase the 'Channels' value in the Sunshine Web UI.");
return;
}
auto current_appid = proc::proc.running();
if (current_appid == 0) {
tree.put("root.resume", 0);
@@ -999,19 +981,11 @@ namespace nvhttp {
response->close_connection_after_response = true;
});
// It is possible that due a race condition that this if-statement gives a false positive,
// the client should try again
if (rtsp_stream::session_count() != 0) {
tree.put("root.resume", 0);
tree.put("root.<xmlattr>.status_code", 503);
tree.put("root.<xmlattr>.status_message", "All sessions must be disconnected before quitting");
return;
}
tree.put("root.cancel", 1);
tree.put("root.<xmlattr>.status_code", 200);
rtsp_stream::terminate_sessions();
if (proc::proc.running() > 0) {
proc::proc.terminate();
}