Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/rfc/ctrlm_rfc_attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ void ctrlm_rfc_attr_t::set_rfc_value(const std::string &value) {
// Convert to JSON
json_t *temp = this->value_json;
json_error_t json_error;
this->value_json = json_loads((const char *)decoded_buf, JSON_REJECT_DUPLICATES, &json_error);
this->value_json = json_loadb((const char *)decoded_buf, decoded_buf_len, JSON_REJECT_DUPLICATES, &json_error);
free(decoded_buf);
decoded_buf = NULL;
Comment thread
Copilot marked this conversation as resolved.
if(this->value_json) {
XLOGD_INFO("successfully got JSON from encoded string, alert the listeners");
json_decref(temp);
Expand All @@ -80,8 +82,6 @@ void ctrlm_rfc_attr_t::set_rfc_value(const std::string &value) {
this->value_json = temp;
return; // return here, we don't want to call listeners on invalid data
}
free(decoded_buf);
decoded_buf = NULL;
} else {
XLOGD_ERROR("failed to decode base64");
return; // return here, we don't want to call listeners on invalid data
Expand Down
12 changes: 8 additions & 4 deletions src/voice/ctrlm_voice_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3870,8 +3870,6 @@ xrsr_power_mode_t voice_xrsr_power_map(ctrlm_power_state_t ctrlm_power_state) {
}

void ctrlm_voice_t::voice_rfc_retrieved_handler(const ctrlm_rfc_attr_t& attr) {
bool enabled = true;

XLOGD_INFO("processing RFC values");

attr.get_rfc_value(JSON_INT_NAME_VOICE_VREX_REQUEST_TIMEOUT, this->prefs.timeout_vrex_connect,0);
Expand Down Expand Up @@ -3992,6 +3990,7 @@ void ctrlm_voice_t::voice_rfc_retrieved_handler(const ctrlm_rfc_attr_t& attr) {
}

if(attr.get_rfc_value(JSON_BOOL_NAME_VOICE_FORCE_VOICE_SETTINGS, this->prefs.force_voice_settings) && this->prefs.force_voice_settings) {
bool enabled = true;
attr.get_rfc_value(JSON_BOOL_NAME_VOICE_ENABLE, enabled);
attr.get_rfc_value(JSON_STR_NAME_VOICE_URL_SRC_PTT, this->prefs.server_url_src_ptt);
attr.get_rfc_value(JSON_STR_NAME_VOICE_URL_SRC_FF, this->prefs.server_url_src_ff);
Expand All @@ -4013,6 +4012,7 @@ void ctrlm_voice_t::voice_rfc_retrieved_handler(const ctrlm_rfc_attr_t& attr) {
}

void ctrlm_voice_t::vsdk_rfc_retrieved_handler(const ctrlm_rfc_attr_t& attr) {
XLOGD_INFO("processing RFC values");
json_t *obj_vsdk = NULL;
if(attr.get_rfc_json_value(&obj_vsdk) && obj_vsdk) {
XLOGD_INFO("VSDK values from XCONF, reopening xrsr..");
Expand All @@ -4021,7 +4021,12 @@ void ctrlm_voice_t::vsdk_rfc_retrieved_handler(const ctrlm_rfc_attr_t& attr) {
}
// This is temporary until the VSDK supports receiving a config on the fly
this->voice_sdk_close();
this->voice_sdk_open(obj_vsdk);
if(this->vsdk_config) {
json_decref(this->vsdk_config);
this->vsdk_config = NULL;
}
this->vsdk_config = obj_vsdk; // Transfer ownership
this->voice_sdk_open(this->vsdk_config);
Comment thread
dwolaver marked this conversation as resolved.
Comment thread
dwolaver marked this conversation as resolved.
this->voice_sdk_update_routes();

// Set init message if read from shared memory
Expand All @@ -4038,7 +4043,6 @@ void ctrlm_voice_t::vsdk_rfc_retrieved_handler(const ctrlm_rfc_attr_t& attr) {
} else {
this->voice_init_set(init.c_str(), false);
}
json_decref(obj_vsdk);
}
}

Expand Down
Loading