[feat] update MiniRTC api calling

This commit is contained in:
dijunkun
2025-12-19 18:22:34 +08:00
parent a967dc72d7
commit d337971de0
5 changed files with 20 additions and 20 deletions

View File

@@ -206,8 +206,8 @@ int Render::ConnectTo(const std::string& remote_id, const char* password,
AddVideoStream(props->peer_, display_info.name.c_str()); AddVideoStream(props->peer_, display_info.name.c_str());
} }
AddAudioStream(props->peer_, props->audio_label_.c_str()); AddAudioStream(props->peer_, props->audio_label_.c_str());
AddDataStream(props->peer_, props->data_label_.c_str()); AddDataStream(props->peer_, props->data_label_.c_str(), false);
AddDataStream(props->peer_, props->file_label_.c_str()); AddDataStream(props->peer_, props->file_label_.c_str(), true);
props->connection_status_ = ConnectionStatus::Connecting; props->connection_status_ = ConnectionStatus::Connecting;

View File

@@ -713,8 +713,8 @@ int Render::CreateConnectionPeer() {
} }
AddAudioStream(peer_, audio_label_.c_str()); AddAudioStream(peer_, audio_label_.c_str());
AddDataStream(peer_, data_label_.c_str()); AddDataStream(peer_, data_label_.c_str(), false);
AddDataStream(peer_, file_label_.c_str()); AddDataStream(peer_, file_label_.c_str(), true);
return 0; return 0;
} else { } else {
return -1; return -1;
@@ -1341,8 +1341,8 @@ void Render::MainLoop() {
remote_action.i.host_name_size = host_name.size(); remote_action.i.host_name_size = host_name.size();
std::string msg = remote_action.to_json(); std::string msg = remote_action.to_json();
int ret = SendReliableDataFrame(peer_, msg.data(), msg.size(), int ret =
data_label_.c_str()); SendDataFrame(peer_, msg.data(), msg.size(), data_label_.c_str());
FreeRemoteAction(remote_action); FreeRemoteAction(remote_action);
if (0 == ret) { if (0 == ret) {
need_to_send_host_info_ = false; need_to_send_host_info_ = false;

View File

@@ -33,7 +33,7 @@ int Render::SendKeyCommand(int key_code, bool is_down) {
if (props->connection_status_ == ConnectionStatus::Connected) { if (props->connection_status_ == ConnectionStatus::Connected) {
std::string msg = remote_action.to_json(); std::string msg = remote_action.to_json();
if (props->peer_) { if (props->peer_) {
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(), SendDataFrame(props->peer_, msg.c_str(), msg.size(),
props->data_label_.c_str()); props->data_label_.c_str());
} }
} }
@@ -104,7 +104,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
std::string msg = remote_action.to_json(); std::string msg = remote_action.to_json();
if (props->peer_) { if (props->peer_) {
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(), SendDataFrame(props->peer_, msg.c_str(), msg.size(),
props->data_label_.c_str()); props->data_label_.c_str());
} }
} else if (SDL_EVENT_MOUSE_WHEEL == event.type && } else if (SDL_EVENT_MOUSE_WHEEL == event.type &&
@@ -151,7 +151,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
std::string msg = remote_action.to_json(); std::string msg = remote_action.to_json();
if (props->peer_) { if (props->peer_) {
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(), SendDataFrame(props->peer_, msg.c_str(), msg.size(),
props->data_label_.c_str()); props->data_label_.c_str());
} }
} }
@@ -495,12 +495,12 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char* user_id,
render->need_to_send_host_info_ = true; render->need_to_send_host_info_ = true;
render->start_screen_capturer_ = true; render->start_screen_capturer_ = true;
render->start_speaker_capturer_ = true; render->start_speaker_capturer_ = true;
// #ifdef CROSSDESK_DEBUG #ifdef CROSSDESK_DEBUG
render->start_mouse_controller_ = false; render->start_mouse_controller_ = false;
render->start_keyboard_capturer_ = false; render->start_keyboard_capturer_ = false;
// #else #else
render->start_mouse_controller_ = true; render->start_mouse_controller_ = true;
// #endif #endif
if (std::all_of(render->connection_status_.begin(), if (std::all_of(render->connection_status_.begin(),
render->connection_status_.end(), [](const auto& kv) { render->connection_status_.end(), [](const auto& kv) {
return kv.first.find("web") != std::string::npos; return kv.first.find("web") != std::string::npos;

View File

@@ -92,7 +92,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
remote_action.d = i; remote_action.d = i;
if (props->connection_status_ == ConnectionStatus::Connected) { if (props->connection_status_ == ConnectionStatus::Connected) {
std::string msg = remote_action.to_json(); std::string msg = remote_action.to_json();
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(), SendDataFrame(props->peer_, msg.c_str(), msg.size(),
props->data_label_.c_str()); props->data_label_.c_str());
} }
} }
@@ -173,7 +173,7 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
remote_action.type = ControlType::audio_capture; remote_action.type = ControlType::audio_capture;
remote_action.a = props->audio_capture_button_pressed_; remote_action.a = props->audio_capture_button_pressed_;
std::string msg = remote_action.to_json(); std::string msg = remote_action.to_json();
SendReliableDataFrame(props->peer_, msg.c_str(), msg.size(), SendDataFrame(props->peer_, msg.c_str(), msg.size(),
props->data_label_.c_str()); props->data_label_.c_str());
} }
} }