[fix] fix incorrect data send function used for control data

This commit is contained in:
dijunkun
2026-01-13 18:13:54 +08:00
parent 0155413c12
commit 92d670916e
3 changed files with 13 additions and 7 deletions

View File

@@ -1376,8 +1376,8 @@ void Render::MainLoop() {
remote_action.i.host_name_size = host_name.size();
std::string msg = remote_action.to_json();
int ret = SendDataFrame(peer_, msg.data(), msg.size(),
control_data_label_.c_str());
int ret = SendReliableDataFrame(peer_, msg.data(), msg.size(),
control_data_label_.c_str());
FreeRemoteAction(remote_action);
if (0 == ret) {
need_to_send_host_info_ = false;
@@ -1897,6 +1897,12 @@ void Render::ProcessSdlEvent(const SDL_Event& event) {
foucs_on_main_window_ = false;
}
break;
case SDL_EVENT_DROP_FILE:
if (stream_window_ &&
SDL_GetWindowID(stream_window_) == event.window.windowID) {
printf("SDL_EVENT_DROP_FILE (%s)\n", event.drop.data);
}
break;
case SDL_EVENT_MOUSE_MOTION:
case SDL_EVENT_MOUSE_BUTTON_DOWN:

View File

@@ -46,7 +46,7 @@ class Render {
Params params_;
PeerPtr* peer_ = nullptr;
std::string audio_label_ = "control_audio";
std::string data_label_ = "control_data";
std::string data_label_ = "data";
std::string file_label_ = "file";
std::string control_data_label_ = "control_data";
std::string file_feedback_label_ = "file_feedback";

View File

@@ -95,8 +95,8 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
remote_action.d = i;
if (props->connection_status_ == ConnectionStatus::Connected) {
std::string msg = remote_action.to_json();
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
props->control_data_label_.c_str());
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(),
props->control_data_label_.c_str());
}
}
props->display_selectable_hovered_ = ImGui::IsWindowHovered();
@@ -176,8 +176,8 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
remote_action.type = ControlType::audio_capture;
remote_action.a = props->audio_capture_button_pressed_;
std::string msg = remote_action.to_json();
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
props->control_data_label_.c_str());
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(),
props->control_data_label_.c_str());
}
}