Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet.cc

Issue 1583233007: [rtp_rtcp] rtcp::Rpsi moved into own file (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtcp_packet.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet.cc
index de5222c4113d4f04e1effb2c9f97e3952a108488..aa7a28669aee7ebc4a5c07b072a46781eeb0e149 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_packet.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet.cc
@@ -18,13 +18,11 @@
using webrtc::RTCPUtility::PT_APP;
using webrtc::RTCPUtility::PT_IJ;
-using webrtc::RTCPUtility::PT_PSFB;
using webrtc::RTCPUtility::PT_RTPFB;
using webrtc::RTCPUtility::PT_SDES;
using webrtc::RTCPUtility::PT_SR;
using webrtc::RTCPUtility::RTCPPacketAPP;
-using webrtc::RTCPUtility::RTCPPacketPSFBRPSI;
using webrtc::RTCPUtility::RTCPPacketReportBlockItem;
using webrtc::RTCPUtility::RTCPPacketRTPFBNACK;
using webrtc::RTCPUtility::RTCPPacketRTPFBNACKItem;
@@ -142,34 +140,6 @@ void CreateSdes(const std::vector<Sdes::Chunk>& chunks,
*pos += (*it).null_octets;
}
}
-
-// Reference picture selection indication (RPSI) (RFC 4585).
-//
-// 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
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// | PB |0| Payload Type| Native RPSI bit string |
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-// | defined per codec ... | Padding (0) |
-// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-
-void CreateRpsi(const RTCPPacketPSFBRPSI& rpsi,
- uint8_t padding_bytes,
- uint8_t* buffer,
- size_t* pos) {
- // Native bit string should be a multiple of 8 bits.
- assert(rpsi.NumberOfValidBits % 8 == 0);
- AssignUWord32(buffer, pos, rpsi.SenderSSRC);
- AssignUWord32(buffer, pos, rpsi.MediaSSRC);
- AssignUWord8(buffer, pos, padding_bytes * 8);
- AssignUWord8(buffer, pos, rpsi.PayloadType);
- memcpy(buffer + *pos, rpsi.NativeBitString, rpsi.NumberOfValidBits / 8);
- *pos += rpsi.NumberOfValidBits / 8;
- memset(buffer + *pos, 0, padding_bytes);
- *pos += padding_bytes;
-}
} // namespace
void RtcpPacket::Append(RtcpPacket* packet) {
@@ -335,48 +305,6 @@ size_t Sdes::BlockLength() const {
return length;
}
-bool Rpsi::Create(uint8_t* packet,
- size_t* index,
- size_t max_length,
- RtcpPacket::PacketReadyCallback* callback) const {
- assert(rpsi_.NumberOfValidBits > 0);
- while (*index + BlockLength() > max_length) {
- if (!OnBufferFull(packet, index, callback))
- return false;
- }
- const uint8_t kFmt = 3;
- CreateHeader(kFmt, PT_PSFB, HeaderLength(), packet, index);
- CreateRpsi(rpsi_, padding_bytes_, packet, index);
- return true;
-}
-
-void Rpsi::WithPictureId(uint64_t picture_id) {
- const uint32_t kPidBits = 7;
- const uint64_t k7MsbZeroMask = 0x1ffffffffffffffULL;
- uint8_t required_bytes = 0;
- uint64_t shifted_pid = picture_id;
- do {
- ++required_bytes;
- shifted_pid = (shifted_pid >> kPidBits) & k7MsbZeroMask;
- } while (shifted_pid > 0);
-
- // Convert picture id to native bit string (natively defined by the video
- // codec).
- int pos = 0;
- for (int i = required_bytes - 1; i > 0; i--) {
- rpsi_.NativeBitString[pos++] =
- 0x80 | static_cast<uint8_t>(picture_id >> (i * kPidBits));
- }
- rpsi_.NativeBitString[pos++] = static_cast<uint8_t>(picture_id & 0x7f);
- rpsi_.NumberOfValidBits = pos * 8;
-
- // Calculate padding bytes (to reach next 32-bit boundary, 1, 2 or 3 bytes).
- padding_bytes_ = 4 - ((2 + required_bytes) % 4);
- if (padding_bytes_ == 4) {
- padding_bytes_ = 0;
- }
-}
-
RawPacket::RawPacket(size_t buffer_length)
: buffer_length_(buffer_length), length_(0) {
buffer_.reset(new uint8_t[buffer_length]);
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698