diff --git a/common/rfb/encoders/ScreenEncoderManager.cxx b/common/rfb/encoders/ScreenEncoderManager.cxx index 5ef8c28..ff29b9b 100644 --- a/common/rfb/encoders/ScreenEncoderManager.cxx +++ b/common/rfb/encoders/ScreenEncoderManager.cxx @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "VideoEncoder.h" #include "VideoEncoderFactory.h" @@ -51,12 +52,6 @@ namespace rfb { template bool ScreenEncoderManager::add_screen(uint8_t index, const Screen &layout) { - printf("SCREEN ADDED: %d (%d, %d, %d, %d)\n", - index, - layout.dimensions.tl.x, - layout.dimensions.tl.y, - layout.dimensions.br.x, - layout.dimensions.br.y); auto *encoder = add_encoder(layout); if (!encoder) return false; @@ -184,13 +179,17 @@ namespace rfb { tbb::parallel_for_each(screens_to_refresh.begin(), screens_to_refresh.end(), [this, pb, &send_frame](uint8_t index) { auto &screen = screens[index]; if (auto *encoder = screen.encoder; encoder) { - if (encoder->render(pb)) { - screen.dirty = false; - std::lock_guard lock(conn_mutex); - send_frame(screen); - } + screen.dirty = encoder->render(pb); } }); + + for (auto index: screens_to_refresh) { + auto &screen = screens[index]; + if (screen.dirty) { + send_frame(screen); + screen.dirty = false; + } + } } else { if (auto encoder = screens[head].encoder; encoder) { if (encoder->render(pb))