Skip to content

Commit

Permalink
always calculate at least one FEC packet (for low blocks)
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Aug 10, 2023
1 parent d6fdf75 commit 0e9a4a6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/FECEnabled.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ static constexpr const uint16_t
// e.g. the final data throughput ~= original data throughput * fec overhead percentage
static uint32_t calculate_n_secondary_fragments(uint32_t n_primary_fragments,uint32_t fec_overhead_perc){
if(fec_overhead_perc<=0)return 0;
return std::lroundf(static_cast<float>(n_primary_fragments) * static_cast<float>(fec_overhead_perc) / 100.0f);
const float n_secondary=static_cast<float>(n_primary_fragments) * static_cast<float>(fec_overhead_perc) / 100.0f;
if(n_secondary<=1.0){
// Always calculate at least one FEC packet
return 1;
}
return std::lroundf(n_secondary);
}
// calculate n from k and percentage as used in FEC terms
// (k: number of primary fragments, n: primary + secondary fragments)
Expand Down

0 comments on commit 0e9a4a6

Please sign in to comment.