From a2b8955c121ad5cc2cea72ad9d3c34ef710fcad3 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Mon, 4 Mar 2024 17:29:44 +0100 Subject: [PATCH] Store 3 decoded frames for more robust stitching --- client/scenes/stream.cpp | 8 +++++--- client/scenes/stream.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/scenes/stream.cpp b/client/scenes/stream.cpp index 5326a16c..b1b3b1d9 100644 --- a/client/scenes/stream.cpp +++ b/client/scenes/stream.cpp @@ -225,10 +225,12 @@ void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_p { if (i.decoder.get() == decoder) { - static_assert(std::tuple_size_v == 2); std::swap(removed, i.latest_frames[0]); - std::swap(i.latest_frames[0], i.latest_frames[1]); - std::swap(i.latest_frames[1], handle); + for (size_t j = 1 ; j < i.latest_frames.size() ; ++j) + { + std::swap(i.latest_frames[j-1], i.latest_frames[j]); + } + std::swap(i.latest_frames.back(), handle); break; } } diff --git a/client/scenes/stream.h b/client/scenes/stream.h index 2db9c224..ef5b0869 100644 --- a/client/scenes/stream.h +++ b/client/scenes/stream.h @@ -56,7 +56,7 @@ private: vk::raii::PipelineLayout blit_pipeline_layout = nullptr; vk::raii::Pipeline blit_pipeline = nullptr; // latest frames from oldest to most recent - std::array, 2> latest_frames; + std::array, 3> latest_frames; static std::optional common_frame(const std::vector &, uint64_t preferred_index); std::shared_ptr frame(std::optional id);