|
|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include "chat_setting.h" |
|
|
|
|
#include "../call/call_video_rate.h" |
|
|
|
|
#include "../utun_instance.h" |
|
|
|
|
#include "../../lib/debug_config.h" |
|
|
|
|
|
|
|
|
|
@ -63,6 +64,7 @@ static const struct chat_setting_def g_setting_defs[] = {
|
|
|
|
|
{"group_autoconnect", CHAT_SETTING_BOOL, 1, 0, 1}, |
|
|
|
|
{"aec_enabled", CHAT_SETTING_BOOL, 1, 0, 1}, /* AEC (SpeexDSP) в звонке, desktop GUI */ |
|
|
|
|
{"call_jitter_max_reserve_ms", CHAT_SETTING_INT, 1000, 500, 2000}, |
|
|
|
|
{"call_video_bitrate_range_kbps", CHAT_SETTING_STRING, 0, 0, 0}, |
|
|
|
|
{"call_compressor_enabled", CHAT_SETTING_BOOL, 1, 0, 1}, |
|
|
|
|
{"call_compressor_max_gain_db",CHAT_SETTING_INT, 15, 1, 60}, |
|
|
|
|
{"member_files_enabled", CHAT_SETTING_BOOL, 1, 0, 1}, |
|
|
|
|
@ -111,6 +113,10 @@ int chat_setting_set_state(struct chat_setting_state* s, const char* name, const
|
|
|
|
|
int v; |
|
|
|
|
|
|
|
|
|
if (def->type == CHAT_SETTING_STRING) { |
|
|
|
|
if (strcmp(name, "call_video_bitrate_range_kbps") == 0) { |
|
|
|
|
uint32_t minimum, maximum; |
|
|
|
|
if (call_video_rate_parse_range(value, &minimum, &maximum)) return -2; |
|
|
|
|
} |
|
|
|
|
if (strlen(value) >= sizeof(s->string_val[0])) { |
|
|
|
|
DEBUG_ERROR(CS_ID, "chat_setting: '%s' string too long bytes=%zu limit=%zu", name, strlen(value), sizeof(s->string_val[0]) - 1); |
|
|
|
|
return -2; |
|
|
|
|
@ -159,6 +165,12 @@ int chat_setting_set_state(struct chat_setting_state* s, const char* name, const
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const char* chat_setting_get_state(const struct chat_setting_state* s, const char* name) { |
|
|
|
|
if (s && name && strcmp(name, "call_video_bitrate_range_kbps") == 0) { |
|
|
|
|
int idx = chat_setting_find(name); |
|
|
|
|
for (int i = 0; s->initialized && i < s->string_count; i++) |
|
|
|
|
if (s->string_idx[i] == idx) return s->string_val[i]; |
|
|
|
|
return CALL_VIDEO_RATE_DEFAULT_RANGE; |
|
|
|
|
} |
|
|
|
|
if (!s || !s->initialized) return NULL; |
|
|
|
|
int idx = chat_setting_find(name); |
|
|
|
|
if (idx < 0) return NULL; |
|
|
|
|
|