From c6aa376968e0bfe15983e2d696239fa10506eae1 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Wed, 28 Aug 2024 18:41:06 +0200 Subject: [PATCH] improve shard accumulator logs --- client/decoder/shard_accumulator.cpp | 12 +++++++----- client/decoder/shard_accumulator.h | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/client/decoder/shard_accumulator.cpp b/client/decoder/shard_accumulator.cpp index db8756de..52432545 100644 --- a/client/decoder/shard_accumulator.cpp +++ b/client/decoder/shard_accumulator.cpp @@ -33,7 +33,6 @@ shard_set::shard_set(uint8_t stream_index) void shard_set::reset(uint64_t frame_index) { - num_shards = 0; min_for_reconstruction = -1; data.clear(); @@ -45,7 +44,7 @@ void shard_set::reset(uint64_t frame_index) bool shard_set::empty() const { - return num_shards == 0; + return data.empty(); } static bool is_complete(const shard_set & shards) @@ -71,8 +70,6 @@ uint16_t shard_set::insert(data_shard && shard) auto idx = shard.shard_idx; if (idx >= data.size()) data.resize(idx + 1); - if (not data[idx]) - ++num_shards; data[idx] = std::move(shard); return idx; } @@ -87,6 +84,7 @@ static void debug_why_not_sent(const shard_set & shards) } int frame_idx = -1; size_t data = 0; + size_t missing = 0; for (const auto & shard: frame) { if (shard) @@ -94,9 +92,12 @@ static void debug_why_not_sent(const shard_set & shards) frame_idx = shard->frame_idx; ++data; } + else + ++missing; } - spdlog::info("frame {} was not sent with {} data shards", frame_idx, data); + bool end = frame.back() and frame.back()->flags & video_stream_data_shard::end_of_frame; + spdlog::info("frame {} was not sent with {} data shards, {}{} missing", frame_idx, data, end ? "" : "at least ", missing); } void shard_accumulator::advance() @@ -113,6 +114,7 @@ void shard_accumulator::push_shard(video_stream_data_shard && shard) if (shard.frame_idx < current.frame_index()) { // frame is in the past, drop it + spdlog::info("Drop shard for old frame {} (current {})", shard.frame_idx, current.frame_index()); } else if (frame_diff == 0) { diff --git a/client/decoder/shard_accumulator.h b/client/decoder/shard_accumulator.h index aa5c8091..7541ccde 100644 --- a/client/decoder/shard_accumulator.h +++ b/client/decoder/shard_accumulator.h @@ -42,7 +42,6 @@ public: using data_shard = xrt::drivers::wivrn::to_headset::video_stream_data_shard; struct shard_set { - size_t num_shards = 0; size_t min_for_reconstruction = -1; std::vector> data; void reset(uint64_t frame_index);