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