Closed openserli closed 7 years ago
Data packets have fragment_idx < fec_k. FEC packets - from fec_k to fec_n
can you tell me what this code mean ? why need alloc more then one blocks for one block_id ?
int ring_idx = -1; for(int i = 0; i < new_blocks; i++) { ring_idx = rx_ring_push(); rx_ring[ring_idx].block_idx = modN(block_idx - new_blocks + i + 1, 256); rx_ring[ring_idx].send_fragment_idx = 0; rx_ring[ring_idx].has_fragments = 0; memset(rx_ring[ring_idx].fragment_map, '\0', fec_n * sizeof(uint8_t)); } return ring_idx;
rx_ring is a circular buffer, where we store packets, grouped by FEC blocks. It has two variables: rx_ring_front (index of the first allocated FEC block) and alloc_size -- number of allocated blocks.
When we receive a new packet it can belongs to:
When we allocate a new block we have following choices:
block idx is rounded by modulo 256 - i.e. 0, 1, 2, ... 255, 0, 1 ... For example:
added to wiki
you say that , block idx is rounded by modulo 256 - i.e. 0, 1, 2, ... 255, 0, 1 ... but int the sender part, the block is will larger then 255, and the receiver side block will not right.
Receiver only use last 8 bits from tx block index:
block_hdr->nonce = ((block_idx & BLOCK_IDX_MASK) << 8) + fragment_idx;
...
uint8_t block_idx = (uint8_t)((block_hdr->nonce >> 8) & 0xff);
hi, can i tell me how to distinguish which is fec packet(redundant) and which is media packet in wifibroadcast? redundant packet should not push to deocder from what i know.