diff --git a/receiver/JFJochReceiverRugnuxStills.cpp b/receiver/JFJochReceiverRugnuxStills.cpp index 0d45e104f..31ffcb4a0 100644 --- a/receiver/JFJochReceiverRugnuxStills.cpp +++ b/receiver/JFJochReceiverRugnuxStills.cpp @@ -91,7 +91,6 @@ void JFJochReceiverRugnuxStills::OnImage(uint32_t id, DataMessage &message, std: return; } live_status.ImageReceived(received); - CountImage(message); const size_t size = message.image.GetCompressedSize(); // Waits for the analysis in a slot of the image buffer, where it can be seen while it waits (it is not sent from @@ -104,7 +103,8 @@ void JFJochReceiverRugnuxStills::OnImage(uint32_t id, DataMessage &message, std: held->slot = image_buffer.GetImageSlot(hold_keep_free); } if (!held->slot) - return; + return; // cancelled while it waited: dropped like a frame arriving after the cancel, and not counted + CountImage(message); // Not chosen (stills_downsample): written as it came, without its analysis held->analyse = StillsImageSelected(message.number, downsample, prepass_images); held->message = message; diff --git a/tests/JFJochReceiverRugnuxTest.cpp b/tests/JFJochReceiverRugnuxTest.cpp index f71def13c..d898604ad 100644 --- a/tests/JFJochReceiverRugnuxTest.cpp +++ b/tests/JFJochReceiverRugnuxTest.cpp @@ -383,8 +383,9 @@ TEST_CASE("JFJochReceiverRugnux_Stills_CancelDuringRun", "[JFJochReceiverRugnux] std::this_thread::sleep_for(std::chrono::milliseconds(100)); } REQUIRE(given < images - 1); - WaitForStatus(service, [](const RugnuxLiveSnapshot &s) { - return s.stills && s.stills->prepass == RugnuxLivePrePass::Done && s.stills->images_analysed > 0; + // Every frame given is analysed before the cancel: one still waiting for a slot when it comes is dropped + WaitForStatus(service, [&](const RugnuxLiveSnapshot &s) { + return s.stills && s.stills->prepass == RugnuxLivePrePass::Done && s.stills->images_analysed == given; }); service.Cancel(false); const auto out = service.Stop();