From 0ab9cd7f83be99b9d088df4356d3b4f00b4db9a0 Mon Sep 17 00:00:00 2001 From: Mikhail Baranov Date: Sat, 20 Apr 2024 19:16:23 +0200 Subject: [PATCH] Fix FecReader block duration estimation #688 The whole combination of factor that enabled the issue are still unclear. The fix is just in simplifying the logic by disabling estimator for the blocks with absent first packet, which should not be a great deal. Apparently the issue could take place during start-up transition, and it basically lead to wrong block length estimation with two times greater value than correct one. --- src/internal_modules/roc_fec/reader.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/internal_modules/roc_fec/reader.cpp b/src/internal_modules/roc_fec/reader.cpp index 98a0036c7..4aeb555f9 100644 --- a/src/internal_modules/roc_fec/reader.cpp +++ b/src/internal_modules/roc_fec/reader.cpp @@ -141,8 +141,12 @@ status::StatusCode Reader::get_next_packet_(packet::PacketPtr& ptr) { fill_block_(); packet::PacketPtr pp = source_block_[next_packet_]; - if (pp && next_packet_ == 0) { - update_block_duration_(pp); + if (next_packet_ == 0) { + if (pp) { + update_block_duration_(pp); + } else { + prev_block_timestamp_valid_ = false; + } } do { @@ -162,18 +166,10 @@ status::StatusCode Reader::get_next_packet_(packet::PacketPtr& ptr) { if (pos == source_block_.size()) { if (source_queue_.size() == 0) { - prev_block_timestamp_valid_ = false; return status::StatusNoData; } } else { pp = source_block_[pos++]; - if (pp && pos == 1) { - update_block_duration_(pp); - } - } - - if (!pp && next_packet_ == 0) { - prev_block_timestamp_valid_ = false; } next_packet_ = pos; } else {