Cleanup flexfec03 TODOs and logs to indicate there is no intent to implement additional features there

Bug: None
Change-Id: I774c2356439ee52e73cd70802f28fa5e5b560b8e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/316925
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40594}
This commit is contained in:
Danil Chapovalov 2023-08-21 19:32:41 +02:00 committed by WebRTC LUCI CQ
parent cc4def36b4
commit 5f3b3db105

View File

@ -49,14 +49,13 @@ constexpr size_t kHeaderSizes[] = {
kBaseHeaderSize + kStreamSpecificHeaderSize + kFlexfecPacketMaskSizes[1], kBaseHeaderSize + kStreamSpecificHeaderSize + kFlexfecPacketMaskSizes[1],
kBaseHeaderSize + kStreamSpecificHeaderSize + kFlexfecPacketMaskSizes[2]}; kBaseHeaderSize + kStreamSpecificHeaderSize + kFlexfecPacketMaskSizes[2]};
// We currently only support single-stream protection. // Flexfec03 implementation only support single-stream protection.
// TODO(brandtr): Update this when we support multistream protection. // For multi-stream protection use implementation of the FlexFEC final standard.
constexpr uint8_t kSsrcCount = 1; constexpr uint8_t kSsrcCount = 1;
// There are three reserved bytes that MUST be set to zero in the header. // There are three reserved bytes that MUST be set to zero in the header.
constexpr uint32_t kReservedBits = 0; constexpr uint32_t kReservedBits = 0;
// TODO(brandtr): Update this when we support multistream protection.
constexpr size_t kPacketMaskOffset = constexpr size_t kPacketMaskOffset =
kBaseHeaderSize + kStreamSpecificHeaderSize; kBaseHeaderSize + kStreamSpecificHeaderSize;
@ -81,8 +80,9 @@ Flexfec03HeaderReader::Flexfec03HeaderReader()
Flexfec03HeaderReader::~Flexfec03HeaderReader() = default; Flexfec03HeaderReader::~Flexfec03HeaderReader() = default;
// TODO(brandtr): Update this function when we support flexible masks, // Flexfec03 implementation doesn't support retransmission and flexible masks.
// retransmissions, and/or several protected SSRCs. // When that features are desired, they should be implemented in the class that
// follows final version of the FlexFEC standard.
bool Flexfec03HeaderReader::ReadFecHeader( bool Flexfec03HeaderReader::ReadFecHeader(
ForwardErrorCorrection::ReceivedFecPacket* fec_packet) const { ForwardErrorCorrection::ReceivedFecPacket* fec_packet) const {
if (fec_packet->pkt->data.size() <= if (fec_packet->pkt->data.size() <=
@ -94,22 +94,22 @@ bool Flexfec03HeaderReader::ReadFecHeader(
bool r_bit = (data[0] & 0x80) != 0; bool r_bit = (data[0] & 0x80) != 0;
if (r_bit) { if (r_bit) {
RTC_LOG(LS_INFO) RTC_LOG(LS_INFO)
<< "FlexFEC packet with retransmission bit set. We do not yet " << "FlexFEC03 packet with retransmission bit set. We do not "
"support this, thus discarding the packet."; "support this, thus discarding the packet.";
return false; return false;
} }
bool f_bit = (data[0] & 0x40) != 0; bool f_bit = (data[0] & 0x40) != 0;
if (f_bit) { if (f_bit) {
RTC_LOG(LS_INFO) RTC_LOG(LS_INFO)
<< "FlexFEC packet with inflexible generator matrix. We do " << "FlexFEC03 packet with inflexible generator matrix. We do "
"not yet support this, thus discarding packet."; "not support this, thus discarding packet.";
return false; return false;
} }
uint8_t ssrc_count = ByteReader<uint8_t>::ReadBigEndian(&data[8]); uint8_t ssrc_count = ByteReader<uint8_t>::ReadBigEndian(&data[8]);
if (ssrc_count != 1) { if (ssrc_count != 1) {
RTC_LOG(LS_INFO) RTC_LOG(LS_INFO)
<< "FlexFEC packet protecting multiple media SSRCs. We do not " << "FlexFEC03 packet protecting multiple media SSRCs. We do not "
"yet support this, thus discarding packet."; "support this, thus discarding packet.";
return false; return false;
} }
uint32_t protected_ssrc = ByteReader<uint32_t>::ReadBigEndian(&data[12]); uint32_t protected_ssrc = ByteReader<uint32_t>::ReadBigEndian(&data[12]);
@ -126,7 +126,7 @@ bool Flexfec03HeaderReader::ReadFecHeader(
// We treat the mask parts as unsigned integers with host order endianness // We treat the mask parts as unsigned integers with host order endianness
// in order to simplify the bit shifting between bytes. // in order to simplify the bit shifting between bytes.
if (fec_packet->pkt->data.size() < kHeaderSizes[0]) { if (fec_packet->pkt->data.size() < kHeaderSizes[0]) {
RTC_LOG(LS_WARNING) << "Discarding truncated FlexFEC packet."; RTC_LOG(LS_WARNING) << "Discarding truncated FlexFEC03 packet.";
return false; return false;
} }
uint8_t* const packet_mask = data + kPacketMaskOffset; uint8_t* const packet_mask = data + kPacketMaskOffset;
@ -163,7 +163,7 @@ bool Flexfec03HeaderReader::ReadFecHeader(
packet_mask_size = kFlexfecPacketMaskSizes[1]; packet_mask_size = kFlexfecPacketMaskSizes[1];
} else { } else {
if (fec_packet->pkt->data.size() < kHeaderSizes[2]) { if (fec_packet->pkt->data.size() < kHeaderSizes[2]) {
RTC_LOG(LS_WARNING) << "Discarding truncated FlexFEC packet."; RTC_LOG(LS_WARNING) << "Discarding truncated FlexFEC03 packet.";
return false; return false;
} }
bool k_bit2 = (packet_mask[6] & 0x80) != 0; bool k_bit2 = (packet_mask[6] & 0x80) != 0;
@ -174,7 +174,7 @@ bool Flexfec03HeaderReader::ReadFecHeader(
packet_mask_size = kFlexfecPacketMaskSizes[2]; packet_mask_size = kFlexfecPacketMaskSizes[2];
} else { } else {
RTC_LOG(LS_WARNING) RTC_LOG(LS_WARNING)
<< "Discarding FlexFEC packet with malformed header."; << "Discarding FlexFEC03 packet with malformed header.";
return false; return false;
} }
// At this point, K-bits 0 and 1 have been removed, and the front-most // At this point, K-bits 0 and 1 have been removed, and the front-most