mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-14 04:30:51 +08:00
[feat] add receiver padding probing configuration
This commit is contained in:
1 parent
a369ba8a3a
commit
c991b33035
7 files changed
+40
-5
No files matched your search
@@ -149,6 +149,14 @@ int ConfigCenter::Load() {
|
||||
*ini_, section_, "direct_start_bitrate_bps", kDefaultDirectStartBitrateBps);
|
||||
relay_start_bitrate_bps_ = ReadStartingBitrate(
|
||||
*ini_, section_, "relay_start_bitrate_bps", kDefaultRelayStartBitrateBps);
|
||||
disable_receiver_padding_probing_ = ini_->GetBoolValue(
|
||||
section_, "disable_receiver_padding_probing",
|
||||
kDefaultDisableReceiverPaddingProbing);
|
||||
if (!ini_->GetValue(section_, "disable_receiver_padding_probing", nullptr)) {
|
||||
ini_->SetBoolValue(section_, "disable_receiver_padding_probing",
|
||||
disable_receiver_padding_probing_);
|
||||
persist_config_migration = true;
|
||||
}
|
||||
// Populate old configurations and repair invalid values so the file shows
|
||||
// the estimates that will actually be used for subsequent connections.
|
||||
for (const auto& entry :
|
||||
@@ -276,6 +284,8 @@ int ConfigCenter::Save() {
|
||||
ini_->SetLongValue(section_, "turn_mode", static_cast<long>(turn_mode_));
|
||||
ini_->SetLongValue(section_, "direct_start_bitrate_bps", direct_start_bitrate_bps_);
|
||||
ini_->SetLongValue(section_, "relay_start_bitrate_bps", relay_start_bitrate_bps_);
|
||||
ini_->SetBoolValue(section_, "disable_receiver_padding_probing",
|
||||
disable_receiver_padding_probing_);
|
||||
ini_->SetBoolValue(section_, "enable_turn",
|
||||
turn_mode_ != TURN_MODE::DISABLED);
|
||||
ini_->SetBoolValue(section_, "enable_srtp", true);
|
||||
@@ -326,6 +336,8 @@ std::string ConfigCenter::ExportSharedHostConfig() const {
|
||||
host.SetLongValue(section_, "turn_mode", static_cast<long>(turn_mode_));
|
||||
host.SetLongValue(section_, "direct_start_bitrate_bps", direct_start_bitrate_bps_);
|
||||
host.SetLongValue(section_, "relay_start_bitrate_bps", relay_start_bitrate_bps_);
|
||||
host.SetBoolValue(section_, "disable_receiver_padding_probing",
|
||||
disable_receiver_padding_probing_);
|
||||
host.SetLongValue(section_, "video_encode_format", static_cast<long>(video_encode_format_));
|
||||
host.SetBoolValue(section_, "trusted_devices_only", trusted_devices_only_.load());
|
||||
host.SetBoolValue(section_, "lock_on_disconnect", lock_on_disconnect_.load());
|
||||
@@ -351,6 +363,9 @@ int ConfigCenter::ApplySharedHostConfig(const std::string& contents) {
|
||||
host, section_, "direct_start_bitrate_bps", kDefaultDirectStartBitrateBps);
|
||||
const int relay_bps = ReadStartingBitrate(
|
||||
host, section_, "relay_start_bitrate_bps", kDefaultRelayStartBitrateBps);
|
||||
const bool disable_receiver_padding_probing = host.GetBoolValue(
|
||||
section_, "disable_receiver_padding_probing",
|
||||
kDefaultDisableReceiverPaddingProbing);
|
||||
const bool trusted = host.GetBoolValue(section_, "trusted_devices_only", false);
|
||||
const bool lock = host.GetBoolValue(section_, "lock_on_disconnect", true);
|
||||
MiniRtcSignalServerAddress address{};
|
||||
@@ -362,6 +377,8 @@ int ConfigCenter::ApplySharedHostConfig(const std::string& contents) {
|
||||
{"turn_mode", std::to_string(turn)}, {"video_encode_format", std::to_string(codec)},
|
||||
{"direct_start_bitrate_bps", std::to_string(direct_bps)},
|
||||
{"relay_start_bitrate_bps", std::to_string(relay_bps)},
|
||||
{"disable_receiver_padding_probing",
|
||||
disable_receiver_padding_probing ? "true" : "false"},
|
||||
{"trusted_devices_only", trusted ? "true" : "false"},
|
||||
{"lock_on_disconnect", lock ? "true" : "false"}}) != 0) return -1;
|
||||
enable_self_hosted_ = self_hosted;
|
||||
@@ -370,6 +387,7 @@ int ConfigCenter::ApplySharedHostConfig(const std::string& contents) {
|
||||
turn_mode_ = static_cast<TURN_MODE>(turn);
|
||||
direct_start_bitrate_bps_ = direct_bps;
|
||||
relay_start_bitrate_bps_ = relay_bps;
|
||||
disable_receiver_padding_probing_ = disable_receiver_padding_probing;
|
||||
video_encode_format_ = static_cast<VIDEO_ENCODE_FORMAT>(codec);
|
||||
trusted_devices_only_.store(trusted);
|
||||
lock_on_disconnect_.store(lock);
|
||||
@@ -664,6 +682,10 @@ int ConfigCenter::GetRelayStartBitrateBps() const {
|
||||
return relay_start_bitrate_bps_;
|
||||
}
|
||||
|
||||
bool ConfigCenter::IsReceiverPaddingProbingDisabled() const {
|
||||
return disable_receiver_padding_probing_;
|
||||
}
|
||||
|
||||
bool ConfigCenter::IsForceRelay() const {
|
||||
return turn_mode_ == TURN_MODE::FORCE_UDP || turn_mode_ == TURN_MODE::FORCE_TCP;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ class ConfigCenter {
|
||||
TURN_MODE GetTurnMode() const;
|
||||
int GetDirectStartBitrateBps() const;
|
||||
int GetRelayStartBitrateBps() const;
|
||||
bool IsReceiverPaddingProbingDisabled() const;
|
||||
bool IsForceRelay() const;
|
||||
bool IsEnableSrtp() const;
|
||||
std::string GetSignalServerHost() const;
|
||||
@@ -112,6 +113,8 @@ class ConfigCenter {
|
||||
static constexpr int kDefaultRelayStartBitrateBps = 500'000;
|
||||
int direct_start_bitrate_bps_ = kDefaultDirectStartBitrateBps;
|
||||
int relay_start_bitrate_bps_ = kDefaultRelayStartBitrateBps;
|
||||
static constexpr bool kDefaultDisableReceiverPaddingProbing = true;
|
||||
bool disable_receiver_padding_probing_ = kDefaultDisableReceiverPaddingProbing;
|
||||
std::string signal_server_host_ = "";
|
||||
std::string signal_server_host_default_ = "api.crossdesk.cn";
|
||||
int signal_server_port_ = 0;
|
||||
|
||||
@@ -318,6 +318,8 @@ int GuiRuntime::CreateConnectionPeer() {
|
||||
params_.turn_mode = static_cast<MiniRtcTurnMode>(config_center_->GetTurnMode());
|
||||
params_.direct_start_bitrate_bps = config_center_->GetDirectStartBitrateBps();
|
||||
params_.relay_start_bitrate_bps = config_center_->GetRelayStartBitrateBps();
|
||||
params_.disable_receiver_padding_probing =
|
||||
config_center_->IsReceiverPaddingProbingDisabled();
|
||||
params_.enable_srtp = config_center_->IsEnableSrtp();
|
||||
params_.video_content_type = MiniRtcVideoContentType::ScreenContent;
|
||||
// Bootstrap outgoing media with fixed defaults. Live overrides come only
|
||||
|
||||
@@ -49,6 +49,8 @@ void GuiRuntime::InitializeLan() {
|
||||
params.turn_mode = MiniRtcTurnMode::MiniRtcTurnDisabled;
|
||||
params.direct_start_bitrate_bps = config_center_->GetDirectStartBitrateBps();
|
||||
params.relay_start_bitrate_bps = config_center_->GetRelayStartBitrateBps();
|
||||
params.disable_receiver_padding_probing =
|
||||
config_center_->IsReceiverPaddingProbingDisabled();
|
||||
params.video_content_type = MiniRtcVideoContentType::ScreenContent;
|
||||
params.video_quality = MiniRtcVideoQuality::MiniRtcVideoQualityHigh;
|
||||
params.video_frame_rate = 60;
|
||||
|
||||
Reference in new issue
Block a user