mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-16 20:17:10 +08:00
[feat] enable speaker capturer by default
This commit is contained in:
@@ -566,6 +566,14 @@ void Render::UpdateInteractions() {
|
||||
screen_capturer_is_started_ = false;
|
||||
}
|
||||
|
||||
if (start_speaker_capturer_ && !speaker_capturer_is_started_) {
|
||||
StartSpeakerCapturer();
|
||||
speaker_capturer_is_started_ = true;
|
||||
} else if (!start_speaker_capturer_ && speaker_capturer_is_started_) {
|
||||
StopSpeakerCapturer();
|
||||
speaker_capturer_is_started_ = false;
|
||||
}
|
||||
|
||||
if (start_mouse_controller_ && !mouse_controller_is_started_) {
|
||||
StartMouseController();
|
||||
mouse_controller_is_started_ = true;
|
||||
@@ -1055,9 +1063,9 @@ void Render::MainLoop() {
|
||||
remote_action.i.host_name[host_name.size()] = '\0';
|
||||
remote_action.i.host_name_size = host_name.size();
|
||||
|
||||
std::vector<char> serialized = SerializeRemoteAction(remote_action);
|
||||
int ret = SendDataFrame(peer_, serialized.data(), serialized.size(),
|
||||
data_label_.c_str());
|
||||
std::string msg = remote_action.to_json();
|
||||
int ret =
|
||||
SendDataFrame(peer_, msg.data(), msg.size(), data_label_.c_str());
|
||||
FreeRemoteAction(remote_action);
|
||||
if (0 == ret) {
|
||||
need_to_send_host_info_ = false;
|
||||
|
||||
@@ -51,7 +51,7 @@ class Render {
|
||||
bool net_traffic_stats_button_pressed_ = false;
|
||||
bool mouse_control_button_pressed_ = false;
|
||||
bool mouse_controller_is_started_ = false;
|
||||
bool audio_capture_button_pressed_ = false;
|
||||
bool audio_capture_button_pressed_ = true;
|
||||
bool control_mouse_ = false;
|
||||
bool streaming_ = false;
|
||||
bool is_control_bar_in_left_ = true;
|
||||
@@ -311,6 +311,8 @@ class Render {
|
||||
bool mouse_controller_is_started_ = false;
|
||||
bool start_screen_capturer_ = false;
|
||||
bool screen_capturer_is_started_ = false;
|
||||
bool start_speaker_capturer_ = false;
|
||||
bool speaker_capturer_is_started_ = false;
|
||||
bool start_keyboard_capturer_ = false;
|
||||
bool keyboard_capturer_is_started_ = false;
|
||||
bool foucs_on_main_window_ = false;
|
||||
|
||||
@@ -28,8 +28,7 @@ int Render::SendKeyCommand(int key_code, bool is_down) {
|
||||
client_properties_.end()) {
|
||||
auto props = client_properties_[controlled_remote_id_];
|
||||
if (props->connection_status_ == ConnectionStatus::Connected) {
|
||||
json j = remote_action.to_json();
|
||||
std::string msg = j.dump();
|
||||
std::string msg = remote_action.to_json();
|
||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||
props->data_label_.c_str());
|
||||
}
|
||||
@@ -97,8 +96,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
|
||||
remote_action.m.flag = MouseFlag::move;
|
||||
}
|
||||
|
||||
json j = remote_action.to_json();
|
||||
std::string msg = j.dump();
|
||||
std::string msg = remote_action.to_json();
|
||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||
props->data_label_.c_str());
|
||||
} else if (SDL_EVENT_MOUSE_WHEEL == event.type &&
|
||||
@@ -132,8 +130,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
|
||||
(float)(event.button.y - props->stream_render_rect_.y) /
|
||||
render_height;
|
||||
|
||||
json j = remote_action.to_json();
|
||||
std::string msg = j.dump();
|
||||
std::string msg = remote_action.to_json();
|
||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||
props->data_label_.c_str());
|
||||
}
|
||||
@@ -321,9 +318,9 @@ void Render::OnReceiveDataBufferCb(const char* data, size_t size,
|
||||
render->mouse_controller_->SendMouseCommand(remote_action,
|
||||
render->selected_display_);
|
||||
} else if (remote_action.type == ControlType::audio_capture) {
|
||||
if (remote_action.a)
|
||||
if (remote_action.a && !render->start_speaker_capturer_)
|
||||
render->StartSpeakerCapturer();
|
||||
else
|
||||
else if (!remote_action.a && render->start_speaker_capturer_)
|
||||
render->StopSpeakerCapturer();
|
||||
} else if (remote_action.type == ControlType::keyboard &&
|
||||
render->keyboard_capturer_) {
|
||||
@@ -422,6 +419,7 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char* user_id,
|
||||
case ConnectionStatus::Closed:
|
||||
render->password_validating_time_ = 0;
|
||||
render->start_screen_capturer_ = false;
|
||||
render->start_speaker_capturer_ = false;
|
||||
render->start_mouse_controller_ = false;
|
||||
render->start_keyboard_capturer_ = false;
|
||||
render->control_mouse_ = false;
|
||||
@@ -462,10 +460,12 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char* user_id,
|
||||
case ConnectionStatus::Connected:
|
||||
render->need_to_send_host_info_ = true;
|
||||
render->start_screen_capturer_ = true;
|
||||
render->start_speaker_capturer_ = true;
|
||||
render->start_mouse_controller_ = true;
|
||||
break;
|
||||
case ConnectionStatus::Closed:
|
||||
render->start_screen_capturer_ = false;
|
||||
render->start_speaker_capturer_ = false;
|
||||
render->start_mouse_controller_ = false;
|
||||
render->start_keyboard_capturer_ = false;
|
||||
render->need_to_send_host_info_ = false;
|
||||
|
||||
@@ -68,8 +68,9 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
remote_action.type = ControlType::display_id;
|
||||
remote_action.d = i;
|
||||
if (props->connection_status_ == ConnectionStatus::Connected) {
|
||||
SendDataFrame(props->peer_, (const char*)&remote_action,
|
||||
sizeof(remote_action), props->data_label_.c_str());
|
||||
std::string msg = remote_action.to_json();
|
||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||
props->data_label_.c_str());
|
||||
}
|
||||
}
|
||||
props->display_selectable_hovered_ = ImGui::IsWindowHovered();
|
||||
@@ -142,8 +143,9 @@ int Render::ControlBar(std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||
RemoteAction remote_action;
|
||||
remote_action.type = ControlType::audio_capture;
|
||||
remote_action.a = props->audio_capture_button_pressed_;
|
||||
SendDataFrame(props->peer_, (const char*)&remote_action,
|
||||
sizeof(remote_action), props->data_label_.c_str());
|
||||
std::string msg = remote_action.to_json();
|
||||
SendDataFrame(props->peer_, msg.c_str(), msg.size(),
|
||||
props->data_label_.c_str());
|
||||
}
|
||||
}
|
||||
if (!props->audio_capture_button_pressed_) {
|
||||
|
||||
Submodule submodules/minirtc updated: ff6b79807e...ec3aa094e7
Reference in New Issue
Block a user