Update header formatters to FlexFEC draft 03.

The only difference is that the F and R bits have changed place.

BUG=webrtc:5654

Review-Url: https://codereview.webrtc.org/2495253002
Cr-Commit-Position: refs/heads/master@{#15064}
This commit is contained in:
brandtr 2016-11-14 04:28:55 -08:00 committed by Commit bot
parent 7c2f174040
commit 25b57ce08e
3 changed files with 16 additions and 16 deletions

View File

@ -85,18 +85,18 @@ bool FlexfecHeaderReader::ReadFecHeader(
LOG(LS_WARNING) << "Discarding truncated FlexFEC packet.";
return false;
}
bool f_bit = (fec_packet->pkt->data[0] & 0x80) != 0;
if (f_bit) {
LOG(LS_INFO) << "FlexFEC packet with inflexible generator matrix. We do "
"not yet support this, thus discarding packet.";
return false;
}
bool r_bit = (fec_packet->pkt->data[0] & 0x40) != 0;
bool r_bit = (fec_packet->pkt->data[0] & 0x80) != 0;
if (r_bit) {
LOG(LS_INFO) << "FlexFEC packet with retransmission bit set. We do not yet "
"support this, thus discarding the packet.";
return false;
}
bool f_bit = (fec_packet->pkt->data[0] & 0x40) != 0;
if (f_bit) {
LOG(LS_INFO) << "FlexFEC packet with inflexible generator matrix. We do "
"not yet support this, thus discarding packet.";
return false;
}
uint8_t ssrc_count =
ByteReader<uint8_t>::ReadBigEndian(&fec_packet->pkt->data[8]);
if (ssrc_count != 1) {
@ -247,8 +247,8 @@ void FlexfecHeaderWriter::FinalizeFecHeader(
const uint8_t* packet_mask,
size_t packet_mask_size,
ForwardErrorCorrection::Packet* fec_packet) const {
fec_packet->data[0] &= 0x7f; // Clear F bit.
fec_packet->data[0] &= 0xbf; // Clear R bit.
fec_packet->data[0] &= 0x7f; // Clear R bit.
fec_packet->data[0] &= 0xbf; // Clear F bit.
ByteWriter<uint8_t>::WriteBigEndian(&fec_packet->data[8], kSsrcCount);
ByteWriter<uint32_t, 3>::WriteBigEndian(&fec_packet->data[9], kReservedBits);
ByteWriter<uint32_t>::WriteBigEndian(&fec_packet->data[12], media_ssrc);

View File

@ -20,7 +20,7 @@ namespace webrtc {
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// 0 |F|R|P|X| CC |M| PT recovery | length recovery |
// 0 |R|F|P|X| CC |M| PT recovery | length recovery |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// 4 | TS recovery |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@ -43,7 +43,7 @@ namespace webrtc {
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// 0 |1|0|P|X| CC |M| PT recovery | length recovery |
// 0 |0|1|P|X| CC |M| PT recovery | length recovery |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// 4 | TS recovery |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

View File

@ -43,8 +43,8 @@ constexpr size_t kFlexfecPacketMaskSizes[] = {2, 6, 14};
constexpr size_t kFlexfecMaxPacketSize = kFlexfecPacketMaskSizes[2];
// Reader tests.
constexpr uint8_t kNoFBit = 0 << 7;
constexpr uint8_t kNoRBit = 0 << 6;
constexpr uint8_t kNoRBit = 0 << 7;
constexpr uint8_t kNoFBit = 0 << 6;
constexpr uint8_t kPtRecovery = 123;
constexpr uint8_t kLengthRecov[] = {0xab, 0xcd};
constexpr uint8_t kTsRecovery[] = {0x01, 0x23, 0x45, 0x67};
@ -173,7 +173,7 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit0Set) {
constexpr uint8_t kUlpfecPacketMask[] = {0x11, 0x02};
// clang-format on
constexpr uint8_t kPacketData[] = {
kNoFBit | kNoRBit, kPtRecovery, kLengthRecov[0], kLengthRecov[1],
kNoRBit | kNoFBit, kPtRecovery, kLengthRecov[0], kLengthRecov[1],
kTsRecovery[0], kTsRecovery[1], kTsRecovery[2], kTsRecovery[3],
kSsrcCount, kReservedBits, kReservedBits, kReservedBits,
kProtSsrc[0], kProtSsrc[1], kProtSsrc[2], kProtSsrc[3],
@ -204,7 +204,7 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit1Set) {
0x08, 0x44, 0x00, 0x84};
// clang-format on
constexpr uint8_t kPacketData[] = {
kNoFBit | kNoRBit, kPtRecovery, kLengthRecov[0], kLengthRecov[1],
kNoRBit | kNoFBit, kPtRecovery, kLengthRecov[0], kLengthRecov[1],
kTsRecovery[0], kTsRecovery[1], kTsRecovery[2], kTsRecovery[3],
kSsrcCount, kReservedBits, kReservedBits, kReservedBits,
kProtSsrc[0], kProtSsrc[1], kProtSsrc[2], kProtSsrc[3],
@ -241,7 +241,7 @@ TEST(FlexfecHeaderReaderTest, ReadsHeaderWithKBit2Set) {
0x88, 0x88, 0x88, 0x88};
// clang-format on
constexpr uint8_t kPacketData[] = {
kNoFBit | kNoRBit, kPtRecovery, kLengthRecov[0], kLengthRecov[1],
kNoRBit | kNoFBit, kPtRecovery, kLengthRecov[0], kLengthRecov[1],
kTsRecovery[0], kTsRecovery[1], kTsRecovery[2], kTsRecovery[3],
kSsrcCount, kReservedBits, kReservedBits, kReservedBits,
kProtSsrc[0], kProtSsrc[1], kProtSsrc[2], kProtSsrc[3],