1.Fix texture update crash; 2.Do not show control window when in server mode

This commit is contained in:
dijunkun
2024-07-19 14:54:53 +08:00
parent 5a1e2c5ed9
commit f446154747
2 changed files with 10 additions and 8 deletions

View File

@@ -372,10 +372,10 @@ int Render::Run() {
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar); ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar);
ImGui::PopStyleVar(); ImGui::PopStyleVar();
ImGui::PopStyleColor(); ImGui::PopStyleColor();
if (!streaming_) { if (streaming_ && is_client_mode_) {
MainWindow();
} else {
ControlWindow(); ControlWindow();
} else {
MainWindow();
} }
ImGui::End(); ImGui::End();
@@ -438,7 +438,7 @@ int Render::Run() {
} }
} else if (event.type == REFRESH_EVENT) { } else if (event.type == REFRESH_EVENT) {
if (stream_texture_) if (stream_texture_)
SDL_UpdateTexture(stream_texture_, NULL, dst_buffer_, 1280 * 720 * 3); SDL_UpdateTexture(stream_texture_, NULL, dst_buffer_, 1280);
} else { } else {
if (connection_established_) { if (connection_established_) {
ProcessMouseKeyEven(event); ProcessMouseKeyEven(event);

View File

@@ -180,13 +180,15 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, void *user_data) {
render->connection_status_str_ = "Connected"; render->connection_status_str_ = "Connected";
render->connection_established_ = true; render->connection_established_ = true;
render->streaming_ = true; render->streaming_ = true;
if (!render->is_client_mode_) {
render->start_screen_capture_ = true;
render->start_mouse_control_ = true;
} else {
SDL_SetWindowSize(render->main_window_, render->stream_window_width_, SDL_SetWindowSize(render->main_window_, render->stream_window_width_,
render->stream_window_height_); render->stream_window_height_);
SDL_SetWindowPosition(render->main_window_, SDL_WINDOWPOS_CENTERED, SDL_SetWindowPosition(render->main_window_, SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED); SDL_WINDOWPOS_CENTERED);
if (!render->is_client_mode_) {
render->start_screen_capture_ = true;
render->start_mouse_control_ = true;
} }
} else if (ConnectionStatus::Disconnected == status) { } else if (ConnectionStatus::Disconnected == status) {
render->connection_status_str_ = "Disconnected"; render->connection_status_str_ = "Disconnected";