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

View File

@@ -180,13 +180,15 @@ void Render::OnConnectionStatusCb(ConnectionStatus status, void *user_data) {
render->connection_status_str_ = "Connected";
render->connection_established_ = 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_,
render->stream_window_height_);
SDL_SetWindowPosition(render->main_window_, 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) {
render->connection_status_str_ = "Disconnected";