mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 21:13:12 -07:00
Add Video Profile Auto Downgrade
This commit is contained in:
parent
3417202049
commit
c19c7869d5
5 changed files with 24 additions and 2 deletions
|
@ -105,6 +105,7 @@ StreamSession::StreamSession(const StreamSessionConnectInfo &connect_info, QObje
|
||||||
chiaki_connect_info.ps5 = chiaki_target_is_ps5(connect_info.target);
|
chiaki_connect_info.ps5 = chiaki_target_is_ps5(connect_info.target);
|
||||||
chiaki_connect_info.host = host_str.constData();
|
chiaki_connect_info.host = host_str.constData();
|
||||||
chiaki_connect_info.video_profile = connect_info.video_profile;
|
chiaki_connect_info.video_profile = connect_info.video_profile;
|
||||||
|
chiaki_connect_info.video_profile_auto_downgrade = true;
|
||||||
|
|
||||||
if(connect_info.regist_key.size() != sizeof(chiaki_connect_info.regist_key))
|
if(connect_info.regist_key.size() != sizeof(chiaki_connect_info.regist_key))
|
||||||
throw ChiakiException("RegistKey invalid");
|
throw ChiakiException("RegistKey invalid");
|
||||||
|
|
|
@ -76,6 +76,7 @@ typedef struct chiaki_connect_info_t
|
||||||
char regist_key[CHIAKI_SESSION_AUTH_SIZE]; // must be completely filled (pad with \0)
|
char regist_key[CHIAKI_SESSION_AUTH_SIZE]; // must be completely filled (pad with \0)
|
||||||
uint8_t morning[0x10];
|
uint8_t morning[0x10];
|
||||||
ChiakiConnectVideoProfile video_profile;
|
ChiakiConnectVideoProfile video_profile;
|
||||||
|
bool video_profile_auto_downgrade; // Downgrade video_profile if server does not seem to support it.
|
||||||
bool enable_keyboard;
|
bool enable_keyboard;
|
||||||
} ChiakiConnectInfo;
|
} ChiakiConnectInfo;
|
||||||
|
|
||||||
|
@ -159,6 +160,7 @@ typedef struct chiaki_session_t
|
||||||
uint8_t morning[CHIAKI_RPCRYPT_KEY_SIZE];
|
uint8_t morning[CHIAKI_RPCRYPT_KEY_SIZE];
|
||||||
uint8_t did[CHIAKI_RP_DID_SIZE];
|
uint8_t did[CHIAKI_RP_DID_SIZE];
|
||||||
ChiakiConnectVideoProfile video_profile;
|
ChiakiConnectVideoProfile video_profile;
|
||||||
|
bool video_profile_auto_downgrade;
|
||||||
bool enable_keyboard;
|
bool enable_keyboard;
|
||||||
} connect_info;
|
} connect_info;
|
||||||
|
|
||||||
|
|
|
@ -963,7 +963,24 @@ static ChiakiErrorCode ctrl_connect(ChiakiCtrl *ctrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!response.server_type_valid)
|
if(response.server_type_valid)
|
||||||
|
{
|
||||||
|
uint8_t server_type = response.rp_server_type[0]; // 0 = PS4, 1 = PS4 Pro, 2 = PS5
|
||||||
|
CHIAKI_LOGI(session->log, "Ctrl got Server Type: %u", (unsigned int)server_type);
|
||||||
|
if(server_type == 0
|
||||||
|
&& session->connect_info.video_profile_auto_downgrade
|
||||||
|
&& session->connect_info.video_profile.height == 1080)
|
||||||
|
{
|
||||||
|
CHIAKI_LOGI(session->log, "1080p was selected but server would not support it. Downgrading.");
|
||||||
|
chiaki_connect_video_profile_preset(
|
||||||
|
&session->connect_info.video_profile,
|
||||||
|
CHIAKI_VIDEO_RESOLUTION_PRESET_720p,
|
||||||
|
session->connect_info.video_profile.max_fps == 60
|
||||||
|
? CHIAKI_VIDEO_FPS_PRESET_60
|
||||||
|
: CHIAKI_VIDEO_FPS_PRESET_30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
CHIAKI_LOGE(session->log, "No valid Server Type in ctrl response");
|
CHIAKI_LOGE(session->log, "No valid Server Type in ctrl response");
|
||||||
|
|
||||||
ctrl->sock = sock;
|
ctrl->sock = sock;
|
||||||
|
|
|
@ -224,6 +224,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_session_init(ChiakiSession *session, Chiaki
|
||||||
memcpy(session->connect_info.did + sizeof(session->connect_info.did) - sizeof(did_suffix), did_suffix, sizeof(did_suffix));
|
memcpy(session->connect_info.did + sizeof(session->connect_info.did) - sizeof(did_suffix), did_suffix, sizeof(did_suffix));
|
||||||
|
|
||||||
session->connect_info.video_profile = connect_info->video_profile;
|
session->connect_info.video_profile = connect_info->video_profile;
|
||||||
|
session->connect_info.video_profile_auto_downgrade = connect_info->video_profile_auto_downgrade;
|
||||||
session->connect_info.enable_keyboard = connect_info->enable_keyboard;
|
session->connect_info.enable_keyboard = connect_info->enable_keyboard;
|
||||||
|
|
||||||
return CHIAKI_ERR_SUCCESS;
|
return CHIAKI_ERR_SUCCESS;
|
||||||
|
|
|
@ -139,10 +139,11 @@ int Host::InitSession(IO *user)
|
||||||
// Build chiaki ps4 stream session
|
// Build chiaki ps4 stream session
|
||||||
chiaki_opus_decoder_init(&(this->opus_decoder), this->log);
|
chiaki_opus_decoder_init(&(this->opus_decoder), this->log);
|
||||||
ChiakiAudioSink audio_sink;
|
ChiakiAudioSink audio_sink;
|
||||||
ChiakiConnectInfo chiaki_connect_info = {0};
|
ChiakiConnectInfo chiaki_connect_info = {};
|
||||||
|
|
||||||
chiaki_connect_info.host = this->host_addr.c_str();
|
chiaki_connect_info.host = this->host_addr.c_str();
|
||||||
chiaki_connect_info.video_profile = this->video_profile;
|
chiaki_connect_info.video_profile = this->video_profile;
|
||||||
|
chiaki_connect_info.video_profile_auto_downgrade = true;
|
||||||
|
|
||||||
chiaki_connect_info.ps5 = this->IsPS5();
|
chiaki_connect_info.ps5 = this->IsPS5();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue