- }
-
- // Now reconstruct the missing pieces.
- unsigned char ch[RS_GROUP_SIZE];
- for (int i = 0; i < max_length; ++i) {
- for (int j = 0; j < RS_GROUP_SIZE; ++j) {
- ch[j] = padded_packets[j][i];
- }
- int ret = decode_rs_char(rs, ch, &missing_packets[0], missing_packets.size());
- if (ret == -1) {
- printf("Failed reconstruction!\n");
- // We might get more data later, so don't remove it.
- return;
- }
- for (int j = 0; j < RS_GROUP_SIZE; ++j) {
- padded_packets[j][i] = ch[j];
- }