[rtp_rtcp] rtcp::Fir moved into own file

Cleaning/Parsing will be done in the https://codereview.webrtc.org/1544403002

BUG=webrtc:5260
R=asapersson@webrtc.org, åsapersson

Review URL: https://codereview.webrtc.org/1581983003 .

Cr-Commit-Position: refs/heads/master@{#11269}
This commit is contained in:
Danil Chapovalov
2016-01-15 13:19:53 +01:00
parent a5eba6c98b
commit 5679da1291
12 changed files with 188 additions and 110 deletions

View File

@ -29,8 +29,6 @@ using webrtc::RTCPUtility::PT_SR;
using webrtc::RTCPUtility::PT_XR;
using webrtc::RTCPUtility::RTCPPacketAPP;
using webrtc::RTCPUtility::RTCPPacketPSFBFIR;
using webrtc::RTCPUtility::RTCPPacketPSFBFIRItem;
using webrtc::RTCPUtility::RTCPPacketPSFBRPSI;
using webrtc::RTCPUtility::RTCPPacketReportBlockItem;
using webrtc::RTCPUtility::RTCPPacketRTPFBNACK;
@ -42,9 +40,6 @@ using webrtc::RTCPUtility::RTCPPacketXR;
namespace webrtc {
namespace rtcp {
namespace {
// Unused SSRC of media source, set to 0.
const uint32_t kUnusedMediaSourceSsrc0 = 0;
void AssignUWord8(uint8_t* buffer, size_t* offset, uint8_t value) {
buffer[(*offset)++] = value;
}
@ -52,10 +47,6 @@ void AssignUWord16(uint8_t* buffer, size_t* offset, uint16_t value) {
ByteWriter<uint16_t>::WriteBigEndian(buffer + *offset, value);
*offset += 2;
}
void AssignUWord24(uint8_t* buffer, size_t* offset, uint32_t value) {
ByteWriter<uint32_t, 3>::WriteBigEndian(buffer + *offset, value);
*offset += 3;
}
void AssignUWord32(uint8_t* buffer, size_t* offset, uint32_t value) {
ByteWriter<uint32_t>::WriteBigEndian(buffer + *offset, value);
*offset += 4;
@ -187,29 +178,6 @@ void CreateRpsi(const RTCPPacketPSFBRPSI& rpsi,
*pos += padding_bytes;
}
// Full intra request (FIR) (RFC 5104).
//
// FCI:
//
// 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
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | SSRC |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | Seq nr. | Reserved |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
void CreateFir(const RTCPPacketPSFBFIR& fir,
const RTCPPacketPSFBFIRItem& fir_item,
uint8_t* buffer,
size_t* pos) {
AssignUWord32(buffer, pos, fir.SenderSSRC);
AssignUWord32(buffer, pos, kUnusedMediaSourceSsrc0);
AssignUWord32(buffer, pos, fir_item.SSRC);
AssignUWord8(buffer, pos, fir_item.CommandSequenceNumber);
AssignUWord24(buffer, pos, 0);
}
// From RFC 3611: RTP Control Protocol Extended Reports (RTCP XR).
//
// Format for XR packets:
@ -437,20 +405,6 @@ void Rpsi::WithPictureId(uint64_t picture_id) {
}
}
bool Fir::Create(uint8_t* packet,
size_t* index,
size_t max_length,
RtcpPacket::PacketReadyCallback* callback) const {
while (*index + BlockLength() > max_length) {
if (!OnBufferFull(packet, index, callback))
return false;
}
const uint8_t kFmt = 4;
CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index);
CreateFir(fir_, fir_item_, packet, index);
return true;
}
bool Xr::Create(uint8_t* packet,
size_t* index,
size_t max_length,