ADDING FEC - fix bug when signaling the amount of written bytes in write_fec_frame
@@ -7,8 +7,8 @@ protoop_arg_t write_fec_frame(picoquic_cnx_t *cnx) {
uint8_t* bytes = (uint8_t *) get_cnx(cnx, CNX_AK_INPUT, 0);
const uint8_t* bytes_max = (const uint8_t *) get_cnx(cnx, CNX_AK_INPUT, 1);
fec_frame_t *ff = (fec_frame_t *) get_cnx(cnx, CNX_AK_INPUT, 2);
- PROTOOP_PRINTF(cnx, "WRITE FEC FRAME\n");
- if (bytes + sizeof(fec_frame_header_t) > bytes_max) {
+ PROTOOP_PRINTF(cnx, "WRITE FEC FRAME FOR BLOCK %u\n", ff->header.repair_fec_payload_id.fec_block_number);
+ if (bytes + sizeof(fec_frame_header_t) + 1 > bytes_max) {
PROTOOP_PRINTF(cnx, "RETURN -1 FEC FRAME: %p > %p\n", (protoop_arg_t) bytes + sizeof(fec_frame_header_t),
(protoop_arg_t) bytes_max);
return -1;
@@ -33,6 +33,7 @@ protoop_arg_t write_fec_frame(picoquic_cnx_t *cnx) {
// copy the frame payload
my_memcpy(bytes + 1 + sizeof(fec_frame_header_t), ff->data, bytes_max - (bytes + 1 + sizeof(fec_frame_header_t)));
my_free(cnx, ff->data);
- set_cnx(cnx, CNX_AK_OUTPUT, 0, (protoop_arg_t) (sizeof(fec_frame_header_t) + ff->header.data_length));
+ set_cnx(cnx, CNX_AK_OUTPUT, 0, (protoop_arg_t) (1 + sizeof(fec_frame_header_t) + ff->header.data_length));
+ PROTOOP_PRINTF(cnx, "WRITTEN FRAME OF LEN %u, TOTAL %u BYTES\n", ff->header.data_length, (1 + sizeof(fec_frame_header_t) + ff->header.data_length));
return 0;
}
\ No newline at end of file
