Skip to content

Commit

Permalink
improve video fec
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Jan 7, 2024
1 parent 449855a commit 1d1704e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/WBStreamRx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ WBStreamRx::WBStreamRx(std::shared_ptr<WBTxRx> txrx,Options options1)
m_console=wifibroadcast::log::create_or_get("wb_rx"+std::to_string(m_options.radio_port));
}
if(m_options.enable_fec){
m_fec_decoder = std::make_unique<FECDecoder>(m_options.fec_rx_queue_depth,MAX_TOTAL_FRAGMENTS_PER_BLOCK,m_options.enable_fec_debug_log);
m_fec_decoder = std::make_unique<FECDecoder>(m_options.fec_rx_queue_depth,MAX_TOTAL_FRAGMENTS_PER_BLOCK,
m_options.enable_fec_debug_log,
m_options.forward_gapped_fragments);
auto cb=[this](const uint8_t *data, int data_len){
on_decoded_packet(data,data_len);
};
Expand Down
2 changes: 2 additions & 0 deletions src/WBStreamRx.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class WBStreamRx {
int packet_queue_size=20;
// enable fec debug log, obviously only if fec is enbaled
bool enable_fec_debug_log=false;
// dirty
bool forward_gapped_fragments= true;
};
WBStreamRx(std::shared_ptr<WBTxRx> txrx,Options options1);
~WBStreamRx();
Expand Down
2 changes: 1 addition & 1 deletion src/fec/FECDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void FECDecoder::process_with_rx_queue(const FECPayloadHdr& header,
block.getBlockIdx());
}
while (block != *rx_queue.front()) {
forwardMissingPrimaryFragmentsIfAvailable(*rx_queue.front(), true);
forwardMissingPrimaryFragmentsIfAvailable(*rx_queue.front(), m_forward_gapped_fragments);
rxQueuePopFront();
}
// then process the block who is fully recoverable or has no gaps in the
Expand Down
8 changes: 6 additions & 2 deletions src/fec/FECDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ class FECDecoder {
explicit FECDecoder(
const unsigned int rx_queue_max_depth,
const unsigned int maxNFragmentsPerBlock = MAX_TOTAL_FRAGMENTS_PER_BLOCK,
bool enable_log_debug = false)
bool enable_log_debug = false,
bool forward_gapped_fragments= true)
: RX_QUEUE_MAX_SIZE(rx_queue_max_depth),
maxNFragmentsPerBlock(maxNFragmentsPerBlock),
m_enable_log_debug(enable_log_debug) {
m_enable_log_debug(enable_log_debug),
m_forward_gapped_fragments(forward_gapped_fragments)
{
assert(rx_queue_max_depth < 20);
assert(rx_queue_max_depth >= 1);
}
Expand All @@ -52,6 +55,7 @@ class FECDecoder {
const unsigned int RX_QUEUE_MAX_SIZE;
const unsigned int maxNFragmentsPerBlock;
const bool m_enable_log_debug;
const bool m_forward_gapped_fragments;
AvgCalculator m_fec_decode_time{};

public:
Expand Down

0 comments on commit 1d1704e

Please sign in to comment.