mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] use new rtc api
This commit is contained in:
@@ -88,8 +88,7 @@ int Render::ControlBar() {
|
|||||||
RemoteAction remote_action;
|
RemoteAction remote_action;
|
||||||
remote_action.type = ControlType::audio_capture;
|
remote_action.type = ControlType::audio_capture;
|
||||||
remote_action.a = audio_capture_button_pressed_;
|
remote_action.a = audio_capture_button_pressed_;
|
||||||
SendData(peer_, DATA_TYPE::DATA, (const char*)&remote_action,
|
SendData(peer_, (const char*)&remote_action, sizeof(remote_action));
|
||||||
sizeof(remote_action));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!audio_capture_button_pressed_) {
|
if (!audio_capture_button_pressed_) {
|
||||||
|
|||||||
@@ -199,9 +199,6 @@ int Render::StartScreenCapturer() {
|
|||||||
.count();
|
.count();
|
||||||
auto duration = now_time - last_frame_time_;
|
auto duration = now_time - last_frame_time_;
|
||||||
if (duration >= 0 && connection_established_) {
|
if (duration >= 0 && connection_established_) {
|
||||||
// SendData(peer_, DATA_TYPE::VIDEO, (const char *)data,
|
|
||||||
// NV12_BUFFER_SIZE);
|
|
||||||
|
|
||||||
XVideoFrame frame;
|
XVideoFrame frame;
|
||||||
frame.data = (const char*)data;
|
frame.data = (const char*)data;
|
||||||
frame.size = size;
|
frame.size = size;
|
||||||
@@ -242,7 +239,7 @@ int Render::StartSpeakerCapturer() {
|
|||||||
int speaker_capturer_init_ret = speaker_capturer_->Init(
|
int speaker_capturer_init_ret = speaker_capturer_->Init(
|
||||||
[this](unsigned char* data, size_t size) -> void {
|
[this](unsigned char* data, size_t size) -> void {
|
||||||
if (connection_established_) {
|
if (connection_established_) {
|
||||||
SendData(peer_, DATA_TYPE::AUDIO, (const char*)data, size);
|
SendAudioFrame(peer_, (const char*)data, size);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ int Render::ProcessMouseEvent(SDL_Event &event) {
|
|||||||
if (control_bar_hovered_) {
|
if (control_bar_hovered_) {
|
||||||
remote_action.m.flag = MouseFlag::move;
|
remote_action.m.flag = MouseFlag::move;
|
||||||
}
|
}
|
||||||
SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action,
|
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
|
||||||
sizeof(remote_action));
|
|
||||||
} else if (SDL_MOUSEBUTTONUP == event.type) {
|
} else if (SDL_MOUSEBUTTONUP == event.type) {
|
||||||
remote_action.type = ControlType::mouse;
|
remote_action.type = ControlType::mouse;
|
||||||
if (SDL_BUTTON_LEFT == event.button.button) {
|
if (SDL_BUTTON_LEFT == event.button.button) {
|
||||||
@@ -74,13 +73,11 @@ int Render::ProcessMouseEvent(SDL_Event &event) {
|
|||||||
if (control_bar_hovered_) {
|
if (control_bar_hovered_) {
|
||||||
remote_action.m.flag = MouseFlag::move;
|
remote_action.m.flag = MouseFlag::move;
|
||||||
}
|
}
|
||||||
SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action,
|
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
|
||||||
sizeof(remote_action));
|
|
||||||
} else if (SDL_MOUSEMOTION == event.type) {
|
} else if (SDL_MOUSEMOTION == event.type) {
|
||||||
remote_action.type = ControlType::mouse;
|
remote_action.type = ControlType::mouse;
|
||||||
remote_action.m.flag = MouseFlag::move;
|
remote_action.m.flag = MouseFlag::move;
|
||||||
SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action,
|
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
|
||||||
sizeof(remote_action));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -96,8 +93,7 @@ int Render::SendKeyEvent(int key_code, bool is_down) {
|
|||||||
}
|
}
|
||||||
remote_action.k.key_value = key_code;
|
remote_action.k.key_value = key_code;
|
||||||
|
|
||||||
SendData(peer_, DATA_TYPE::DATA, (const char *)&remote_action,
|
SendData(peer_, (const char *)&remote_action, sizeof(remote_action));
|
||||||
sizeof(remote_action));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -118,7 +114,7 @@ void Render::SdlCaptureAudioIn(void *userdata, Uint8 *stream, int len) {
|
|||||||
|
|
||||||
if (1) {
|
if (1) {
|
||||||
if ("Connected" == render->connection_status_str_) {
|
if ("Connected" == render->connection_status_str_) {
|
||||||
SendData(render->peer_, DATA_TYPE::AUDIO, (const char *)stream, len);
|
SendAudioFrame(render->peer_, (const char *)stream, len);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
memcpy(render->audio_buffer_, stream, len);
|
memcpy(render->audio_buffer_, stream, len);
|
||||||
@@ -131,7 +127,7 @@ void Render::SdlCaptureAudioIn(void *userdata, Uint8 *stream, int len) {
|
|||||||
void Render::SdlCaptureAudioOut(void *userdata, Uint8 *stream, int len) {
|
void Render::SdlCaptureAudioOut(void *userdata, Uint8 *stream, int len) {
|
||||||
// Render *render = (Render *)userdata;
|
// Render *render = (Render *)userdata;
|
||||||
// if ("Connected" == render->connection_status_str_) {
|
// if ("Connected" == render->connection_status_str_) {
|
||||||
// SendData(render->peer_, DATA_TYPE::AUDIO, (const char *)stream, len);
|
// SendAudioFrame(render->peer_, (const char *)stream, len);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (!render->audio_buffer_fresh_) {
|
// if (!render->audio_buffer_fresh_) {
|
||||||
@@ -286,8 +282,8 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, const char *user_id,
|
|||||||
remote_action.type = ControlType::host_infomation;
|
remote_action.type = ControlType::host_infomation;
|
||||||
memcpy(&remote_action.i.host_name, host_name.data(), host_name.size());
|
memcpy(&remote_action.i.host_name, host_name.data(), host_name.size());
|
||||||
remote_action.i.host_name_size = host_name.size();
|
remote_action.i.host_name_size = host_name.size();
|
||||||
int ret = SendData(render->peer_, DATA_TYPE::DATA,
|
int ret = SendData(render->peer_, (const char *)&remote_action,
|
||||||
(const char *)&remote_action, sizeof(remote_action));
|
sizeof(remote_action));
|
||||||
if (0 == ret) {
|
if (0 == ret) {
|
||||||
render->hostname_sent_ = true;
|
render->hostname_sent_ = true;
|
||||||
}
|
}
|
||||||
|
|||||||
2
thirdparty/projectx
vendored
2
thirdparty/projectx
vendored
Submodule thirdparty/projectx updated: 38fabc9741...09c0ab9235
Reference in New Issue
Block a user