diff --git a/webrtc/logging/rtc_event_log/rtc_event_log2text.cc b/webrtc/logging/rtc_event_log/rtc_event_log2text.cc index cddd91c53c..b2d537e3b3 100644 --- a/webrtc/logging/rtc_event_log/rtc_event_log2text.cc +++ b/webrtc/logging/rtc_event_log/rtc_event_log2text.cc @@ -26,10 +26,8 @@ #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" @@ -266,28 +264,6 @@ void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block, << "\tssrc=" << pli.sender_ssrc() << std::endl; break; } - case webrtc::rtcp::Sli::kFeedbackMessageType: { - webrtc::rtcp::Sli sli; - if (!sli.Parse(rtcp_block)) - return; - if (ExcludePacket(direction, media_type, sli.sender_ssrc())) - return; - std::cout << log_timestamp << "\t" - << "RTCP_SLI" << StreamInfo(direction, media_type) - << "\tssrc=" << sli.sender_ssrc() << std::endl; - break; - } - case webrtc::rtcp::Rpsi::kFeedbackMessageType: { - webrtc::rtcp::Rpsi rpsi; - if (!rpsi.Parse(rtcp_block)) - return; - if (ExcludePacket(direction, media_type, rpsi.sender_ssrc())) - return; - std::cout << log_timestamp << "\t" - << "RTCP_RPSI" << StreamInfo(direction, media_type) - << "\tssrc=" << rpsi.sender_ssrc() << std::endl; - break; - } case webrtc::rtcp::Fir::kFeedbackMessageType: { webrtc::rtcp::Fir fir; if (!fir.Parse(rtcp_block)) diff --git a/webrtc/modules/rtp_rtcp/BUILD.gn b/webrtc/modules/rtp_rtcp/BUILD.gn index f2e53bbbfa..541edd9258 100644 --- a/webrtc/modules/rtp_rtcp/BUILD.gn +++ b/webrtc/modules/rtp_rtcp/BUILD.gn @@ -74,8 +74,6 @@ rtc_static_library("rtp_rtcp") { "source/rtcp_packet/remb.h", "source/rtcp_packet/report_block.cc", "source/rtcp_packet/report_block.h", - "source/rtcp_packet/rpsi.cc", - "source/rtcp_packet/rpsi.h", "source/rtcp_packet/rrtr.cc", "source/rtcp_packet/rrtr.h", "source/rtcp_packet/rtpfb.cc", @@ -84,8 +82,6 @@ rtc_static_library("rtp_rtcp") { "source/rtcp_packet/sdes.h", "source/rtcp_packet/sender_report.cc", "source/rtcp_packet/sender_report.h", - "source/rtcp_packet/sli.cc", - "source/rtcp_packet/sli.h", "source/rtcp_packet/target_bitrate.cc", "source/rtcp_packet/target_bitrate.h", "source/rtcp_packet/tmmb_item.cc", @@ -255,11 +251,9 @@ if (rtc_include_tests) { "source/rtcp_packet/receiver_report_unittest.cc", "source/rtcp_packet/remb_unittest.cc", "source/rtcp_packet/report_block_unittest.cc", - "source/rtcp_packet/rpsi_unittest.cc", "source/rtcp_packet/rrtr_unittest.cc", "source/rtcp_packet/sdes_unittest.cc", "source/rtcp_packet/sender_report_unittest.cc", - "source/rtcp_packet/sli_unittest.cc", "source/rtcp_packet/target_bitrate_unittest.cc", "source/rtcp_packet/tmmbn_unittest.cc", "source/rtcp_packet/tmmbr_unittest.cc", diff --git a/webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h b/webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h index ab9fc40167..7df8a131c6 100644 --- a/webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h +++ b/webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h @@ -15,6 +15,7 @@ #include #include +#include "webrtc/base/deprecation.h" #include "webrtc/common_types.h" #include "webrtc/modules/include/module_common_types.h" #include "webrtc/system_wrappers/include/clock.h" @@ -95,8 +96,6 @@ enum RTCPPacketType : uint32_t { kRtcpSrReq = 0x0400, kRtcpXrVoipMetric = 0x0800, kRtcpApp = 0x1000, - kRtcpSli = 0x4000, - kRtcpRpsi = 0x8000, kRtcpRemb = 0x10000, kRtcpTransmissionTimeOffset = 0x20000, kRtcpXrReceiverReferenceTime = 0x40000, @@ -222,11 +221,11 @@ class RtcpIntraFrameObserver { public: virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) = 0; - virtual void OnReceivedSLI(uint32_t ssrc, - uint8_t picture_id) = 0; + RTC_DEPRECATED virtual void OnReceivedSLI(uint32_t ssrc, + uint8_t picture_id) {} - virtual void OnReceivedRPSI(uint32_t ssrc, - uint64_t picture_id) = 0; + RTC_DEPRECATED virtual void OnReceivedRPSI(uint32_t ssrc, + uint64_t picture_id) {} virtual ~RtcpIntraFrameObserver() {} }; diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc deleted file mode 100644 index cfa59d6f2d..0000000000 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" - -#include "webrtc/base/checks.h" -#include "webrtc/base/logging.h" -#include "webrtc/modules/rtp_rtcp/source/byte_io.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" -#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" - -using webrtc::RtpUtility::Word32Align; - -namespace webrtc { -namespace rtcp { -constexpr uint8_t Rpsi::kFeedbackMessageType; -// RFC 4585: Feedback format. -// Reference picture selection indication (RPSI) (RFC 4585). -// -// 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 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// |V=2|P| RPSI=3 | PT=PSFB=206 | length | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// 0 | SSRC of packet sender | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// 4 | SSRC of media source | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// 8 | Padding Bits | -// 9 |0| Payload Type| -// 10 | Native RPSI bit string : -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// : defined per codec ... | Padding (0) | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -namespace { -constexpr size_t kPaddingSizeOffset = 8; -constexpr size_t kPayloadTypeOffset = 9; -constexpr size_t kBitStringOffset = 10; - -constexpr size_t kPidBits = 7; -// Calculates number of bytes required to store given picture id. -uint8_t RequiredBytes(uint64_t picture_id) { - uint8_t required_bytes = 0; - uint64_t shifted_pid = picture_id; - do { - ++required_bytes; - shifted_pid >>= kPidBits; - } while (shifted_pid > 0); - - return required_bytes; -} -} // namespace - -Rpsi::Rpsi() - : payload_type_(0), - picture_id_(0), - block_length_(CalculateBlockLength(1)) {} - -bool Rpsi::Parse(const CommonHeader& packet) { - RTC_DCHECK_EQ(packet.type(), kPacketType); - RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); - - if (packet.payload_size_bytes() < kCommonFeedbackLength + 4) { - LOG(LS_WARNING) << "Packet is too small to be a valid RPSI packet."; - return false; - } - - ParseCommonFeedback(packet.payload()); - - uint8_t padding_bits = packet.payload()[kPaddingSizeOffset]; - if (padding_bits % 8 != 0) { - LOG(LS_WARNING) << "Unknown rpsi packet with fractional number of bytes."; - return false; - } - size_t padding_bytes = padding_bits / 8; - if (padding_bytes + kBitStringOffset >= packet.payload_size_bytes()) { - LOG(LS_WARNING) << "Too many padding bytes in a RPSI packet."; - return false; - } - size_t padding_offset = packet.payload_size_bytes() - padding_bytes; - payload_type_ = packet.payload()[kPayloadTypeOffset] & 0x7f; - picture_id_ = 0; - for (size_t pos = kBitStringOffset; pos < padding_offset; ++pos) { - picture_id_ <<= kPidBits; - picture_id_ |= (packet.payload()[pos] & 0x7f); - } - // Required bytes might become less than came in the packet. - block_length_ = CalculateBlockLength(RequiredBytes(picture_id_)); - return true; -} - -bool Rpsi::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; - } - size_t index_end = *index + BlockLength(); - - CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, - index); - CreateCommonFeedback(packet + *index); - *index += kCommonFeedbackLength; - - size_t bitstring_size_bytes = RequiredBytes(picture_id_); - size_t padding_bytes = - Word32Align(2 + bitstring_size_bytes) - (2 + bitstring_size_bytes); - packet[(*index)++] = padding_bytes * 8; - packet[(*index)++] = payload_type_; - - // Convert picture id to native bit string (defined by the video codec). - for (size_t i = bitstring_size_bytes - 1; i > 0; --i) { - packet[(*index)++] = - 0x80 | static_cast(picture_id_ >> (i * kPidBits)); - } - packet[(*index)++] = static_cast(picture_id_ & 0x7f); - constexpr uint8_t kPadding = 0; - for (size_t i = 0; i < padding_bytes; ++i) - packet[(*index)++] = kPadding; - RTC_CHECK_EQ(*index, index_end); - return true; -} - -void Rpsi::SetPayloadType(uint8_t payload) { - RTC_DCHECK_LE(payload, 0x7f); - payload_type_ = payload; -} - -void Rpsi::SetPictureId(uint64_t picture_id) { - picture_id_ = picture_id; - block_length_ = CalculateBlockLength(RequiredBytes(picture_id_)); -} - -size_t Rpsi::CalculateBlockLength(uint8_t bitstring_size_bytes) { - return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength + - Word32Align(2 + bitstring_size_bytes); -} -} // namespace rtcp -} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h deleted file mode 100644 index d65023d8c3..0000000000 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_ -#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_ - -#include "webrtc/base/basictypes.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h" - -namespace webrtc { -namespace rtcp { -class CommonHeader; - -// Reference picture selection indication (RPSI) (RFC 4585). -// Assumes native bit string stores PictureId (VP8, VP9). -class Rpsi : public Psfb { - public: - static constexpr uint8_t kFeedbackMessageType = 3; - Rpsi(); - ~Rpsi() override {} - - // Parse assumes header is already parsed and validated. - bool Parse(const CommonHeader& packet); - - void SetPayloadType(uint8_t payload); - void SetPictureId(uint64_t picture_id); - - uint8_t payload_type() const { return payload_type_; } - uint64_t picture_id() const { return picture_id_; } - - protected: - bool Create(uint8_t* packet, - size_t* index, - size_t max_length, - RtcpPacket::PacketReadyCallback* callback) const override; - - private: - size_t BlockLength() const override { return block_length_; } - static size_t CalculateBlockLength(uint8_t bitstring_size_bytes); - - uint8_t payload_type_; - uint64_t picture_id_; - size_t block_length_; -}; -} // namespace rtcp -} // namespace webrtc -#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RPSI_H_ diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc deleted file mode 100644 index 14100797e7..0000000000 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" - -#include "webrtc/test/gmock.h" -#include "webrtc/test/gtest.h" -#include "webrtc/test/rtcp_packet_parser.h" - -using testing::ElementsAreArray; -using testing::make_tuple; -using webrtc::rtcp::Rpsi; - -namespace webrtc { -namespace { -const uint32_t kSenderSsrc = 0x12345678; -const uint32_t kRemoteSsrc = 0x23456789; -// 10000|01 100001|0 1000011 (7 bits = 1 byte in native string). -const uint64_t kPictureId = 0x106143; -const uint8_t kPayloadType = 100; -// Manually created Rpsi packet matching constants above. -const uint8_t kPacket[] = {0x83, 206, 0x00, 0x04, - 0x12, 0x34, 0x56, 0x78, - 0x23, 0x45, 0x67, 0x89, - 24, 100, 0xc1, 0xc2, - 0x43, 0, 0, 0}; -} // namespace - -TEST(RtcpPacketRpsiTest, Parse) { - Rpsi mutable_parsed; - EXPECT_TRUE(test::ParseSinglePacket(kPacket, &mutable_parsed)); - const Rpsi& parsed = mutable_parsed; // Read values from constant object. - - EXPECT_EQ(kSenderSsrc, parsed.sender_ssrc()); - EXPECT_EQ(kRemoteSsrc, parsed.media_ssrc()); - EXPECT_EQ(kPayloadType, parsed.payload_type()); - EXPECT_EQ(kPictureId, parsed.picture_id()); -} - -TEST(RtcpPacketRpsiTest, Create) { - Rpsi rpsi; - rpsi.SetSenderSsrc(kSenderSsrc); - rpsi.SetMediaSsrc(kRemoteSsrc); - rpsi.SetPayloadType(kPayloadType); - rpsi.SetPictureId(kPictureId); - - rtc::Buffer packet = rpsi.Build(); - - EXPECT_THAT(make_tuple(packet.data(), packet.size()), - ElementsAreArray(kPacket)); -} - -TEST(RtcpPacketRpsiTest, ParseFailsOnTooSmallPacket) { - Rpsi rpsi; - rpsi.SetSenderSsrc(kSenderSsrc); - rpsi.SetMediaSsrc(kRemoteSsrc); - - rtc::Buffer packet = rpsi.Build(); - packet[3]--; // Reduce size field by one word (4 bytes). - packet.SetSize(packet.size() - 4); - - EXPECT_FALSE(test::ParseSinglePacket(packet, &rpsi)); -} - -TEST(RtcpPacketRpsiTest, ParseFailsOnFractionalPaddingBytes) { - Rpsi rpsi; - rpsi.SetSenderSsrc(kSenderSsrc); - rpsi.SetMediaSsrc(kRemoteSsrc); - rpsi.SetPictureId(kPictureId); - rtc::Buffer packet = rpsi.Build(); - uint8_t* padding_bits = packet.data() + 12; - uint8_t saved_padding_bits = *padding_bits; - ASSERT_TRUE(test::ParseSinglePacket(packet, &rpsi)); - - for (uint8_t i = 1; i < 8; ++i) { - *padding_bits = saved_padding_bits + i; - EXPECT_FALSE(test::ParseSinglePacket(packet, &rpsi)); - } -} - -TEST(RtcpPacketRpsiTest, ParseFailsOnTooBigPadding) { - Rpsi rpsi; - rpsi.SetSenderSsrc(kSenderSsrc); - rpsi.SetMediaSsrc(kRemoteSsrc); - rpsi.SetPictureId(1); // Small picture id that occupy just 1 byte. - rtc::Buffer packet = rpsi.Build(); - uint8_t* padding_bits = packet.data() + 12; - ASSERT_TRUE(test::ParseSinglePacket(packet, &rpsi)); - - *padding_bits += 8; - EXPECT_FALSE(test::ParseSinglePacket(packet, &rpsi)); -} - -// For raw rpsi packet extract how many bytes are used to store picture_id. -size_t UsedBytes(const rtc::Buffer& packet) { // Works for small packets only. - RTC_CHECK_EQ(packet.data()[2], 0); // Assume packet is small. - size_t total_rpsi_payload_bytes = 4 * (packet.data()[3] - 2) - 2; - uint8_t padding_bits = packet.data()[12]; - RTC_CHECK_EQ(padding_bits % 8, 0); - return total_rpsi_payload_bytes - (padding_bits / 8); -} - -TEST(RtcpPacketRpsiTest, WithOneByteNativeString) { - Rpsi rpsi; - // 1000001 (7 bits = 1 byte in native string). - const uint64_t kPictureId = 0x41; - const uint16_t kNumberOfValidBytes = 1; - rpsi.SetPictureId(kPictureId); - - rtc::Buffer packet = rpsi.Build(); - EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet)); - - Rpsi parsed; - EXPECT_TRUE(test::ParseSinglePacket(packet, &parsed)); - EXPECT_EQ(kPictureId, parsed.picture_id()); -} - -TEST(RtcpPacketRpsiTest, WithTwoByteNativeString) { - Rpsi rpsi; - // |1 0000001 (7 bits = 1 byte in native string). - const uint64_t kPictureId = 0x81; - const uint16_t kNumberOfValidBytes = 2; - rpsi.SetPictureId(kPictureId); - - rtc::Buffer packet = rpsi.Build(); - EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet)); - - Rpsi parsed; - EXPECT_TRUE(test::ParseSinglePacket(packet, &parsed)); - EXPECT_EQ(kPictureId, parsed.picture_id()); -} - -TEST(RtcpPacketRpsiTest, WithThreeByteNativeString) { - Rpsi rpsi; - // 10000|00 100000|0 1000000 (7 bits = 1 byte in native string). - const uint64_t kPictureId = 0x102040; - const uint16_t kNumberOfValidBytes = 3; - rpsi.SetPictureId(kPictureId); - - rtc::Buffer packet = rpsi.Build(); - EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet)); - - Rpsi parsed; - EXPECT_TRUE(test::ParseSinglePacket(packet, &parsed)); - EXPECT_EQ(kPictureId, parsed.picture_id()); -} - -TEST(RtcpPacketRpsiTest, WithFourByteNativeString) { - Rpsi rpsi; - // 1000|001 00001|01 100001|1 1000010 (7 bits = 1 byte in native string). - const uint64_t kPictureId = 0x84161C2; - const uint16_t kNumberOfValidBytes = 4; - rpsi.SetPictureId(kPictureId); - - rtc::Buffer packet = rpsi.Build(); - EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet)); - - Rpsi parsed; - EXPECT_TRUE(test::ParseSinglePacket(packet, &parsed)); - EXPECT_EQ(kPictureId, parsed.picture_id()); -} - -TEST(RtcpPacketRpsiTest, WithMaxPictureId) { - Rpsi rpsi; - // 1 1111111| 1111111 1|111111 11|11111 111|1111 1111|111 11111| - // 11 111111|1 1111111 (7 bits = 1 byte in native string). - const uint64_t kPictureId = 0xffffffffffffffff; - const uint16_t kNumberOfValidBytes = 10; - rpsi.SetPictureId(kPictureId); - - rtc::Buffer packet = rpsi.Build(); - EXPECT_EQ(kNumberOfValidBytes, UsedBytes(packet)); - - Rpsi parsed; - EXPECT_TRUE(test::ParseSinglePacket(packet, &parsed)); - EXPECT_EQ(kPictureId, parsed.picture_id()); -} -} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.cc deleted file mode 100644 index 03689b374d..0000000000 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" - -#include "webrtc/base/checks.h" -#include "webrtc/base/logging.h" -#include "webrtc/modules/rtp_rtcp/source/byte_io.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" - -namespace webrtc { -namespace rtcp { -constexpr uint8_t Sli::kFeedbackMessageType; -// RFC 4585: Feedback format. -// -// Common packet format: -// -// 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 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// |V=2|P| FMT | PT | length | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | SSRC of packet sender | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | SSRC of media source | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// : Feedback Control Information (FCI) : -// : : -// -// Slice loss indication (SLI) (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 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | First | Number | PictureID | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -Sli::Macroblocks::Macroblocks(uint8_t picture_id, - uint16_t first, - uint16_t number) { - RTC_DCHECK_LE(first, 0x1fff); - RTC_DCHECK_LE(number, 0x1fff); - RTC_DCHECK_LE(picture_id, 0x3f); - item_ = (first << 19) | (number << 6) | picture_id; -} - -void Sli::Macroblocks::Parse(const uint8_t* buffer) { - item_ = ByteReader::ReadBigEndian(buffer); -} - -void Sli::Macroblocks::Create(uint8_t* buffer) const { - ByteWriter::WriteBigEndian(buffer, item_); -} - -bool Sli::Parse(const CommonHeader& packet) { - RTC_DCHECK_EQ(packet.type(), kPacketType); - RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); - - if (packet.payload_size_bytes() < - kCommonFeedbackLength + Macroblocks::kLength) { - LOG(LS_WARNING) << "Packet is too small to be a valid SLI packet"; - return false; - } - - size_t number_of_items = - (packet.payload_size_bytes() - kCommonFeedbackLength) / - Macroblocks::kLength; - - ParseCommonFeedback(packet.payload()); - items_.resize(number_of_items); - - const uint8_t* next_item = packet.payload() + kCommonFeedbackLength; - for (Macroblocks& item : items_) { - item.Parse(next_item); - next_item += Macroblocks::kLength; - } - - return true; -} - -bool Sli::Create(uint8_t* packet, - size_t* index, - size_t max_length, - RtcpPacket::PacketReadyCallback* callback) const { - RTC_DCHECK(!items_.empty()); - while (*index + BlockLength() > max_length) { - if (!OnBufferFull(packet, index, callback)) - return false; - } - CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, - index); - CreateCommonFeedback(packet + *index); - *index += kCommonFeedbackLength; - for (const Macroblocks& item : items_) { - item.Create(packet + *index); - *index += Macroblocks::kLength; - } - return true; -} - -} // namespace rtcp -} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h deleted file mode 100644 index 8d42baf0e1..0000000000 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - * - */ -#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ -#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ - -#include - -#include "webrtc/base/basictypes.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h" - -namespace webrtc { -namespace rtcp { -class CommonHeader; - -// Slice loss indication (SLI) (RFC 4585). -class Sli : public Psfb { - public: - static constexpr uint8_t kFeedbackMessageType = 2; - class Macroblocks { - public: - static constexpr size_t kLength = 4; - Macroblocks() : item_(0) {} - Macroblocks(uint8_t picture_id, uint16_t first, uint16_t number); - ~Macroblocks() {} - - void Parse(const uint8_t* buffer); - void Create(uint8_t* buffer) const; - - uint16_t first() const { return item_ >> 19; } - uint16_t number() const { return (item_ >> 6) & 0x1fff; } - uint8_t picture_id() const { return (item_ & 0x3f); } - - private: - uint32_t item_; - }; - - Sli() {} - ~Sli() override {} - - // Parse assumes header is already parsed and validated. - bool Parse(const CommonHeader& packet); - - void AddPictureId(uint8_t picture_id) { - items_.emplace_back(picture_id, 0, 0x1fff); - } - void AddPictureId(uint8_t picture_id, - uint16_t first_macroblock, - uint16_t number_macroblocks) { - items_.emplace_back(picture_id, first_macroblock, number_macroblocks); - } - - const std::vector& macroblocks() const { return items_; } - - protected: - bool Create(uint8_t* packet, - size_t* index, - size_t max_length, - RtcpPacket::PacketReadyCallback* callback) const override; - - private: - size_t BlockLength() const override { - return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength + - items_.size() * Macroblocks::kLength; - } - - std::vector items_; -}; - -} // namespace rtcp -} // namespace webrtc -#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_SLI_H_ diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli_unittest.cc deleted file mode 100644 index 8468100bb2..0000000000 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sli_unittest.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" - -#include "webrtc/test/gmock.h" -#include "webrtc/test/gtest.h" -#include "webrtc/test/rtcp_packet_parser.h" - -using testing::ElementsAreArray; -using testing::make_tuple; -using webrtc::rtcp::Sli; - -namespace webrtc { -namespace { -constexpr uint32_t kSenderSsrc = 0x12345678; -constexpr uint32_t kRemoteSsrc = 0x23456789; - -constexpr uint8_t kPictureId = 0x3f; -constexpr uint16_t kFirstMb = 0x1e61; -constexpr uint16_t kNumberOfMb = 0x1a0a; -constexpr uint32_t kSliItem = (static_cast(kFirstMb) << 19) | - (static_cast(kNumberOfMb) << 6) | - static_cast(kPictureId); - -// Manually created Sli packet matching constants above. -constexpr uint8_t kPacket[] = {0x82, 206, 0x00, 0x03, - 0x12, 0x34, 0x56, 0x78, - 0x23, 0x45, 0x67, 0x89, - (kSliItem >> 24) & 0xff, - (kSliItem >> 16) & 0xff, - (kSliItem >> 8) & 0xff, - kSliItem & 0xff}; -} // namespace - -TEST(RtcpPacketSliTest, Create) { - Sli sli; - sli.SetSenderSsrc(kSenderSsrc); - sli.SetMediaSsrc(kRemoteSsrc); - sli.AddPictureId(kPictureId, kFirstMb, kNumberOfMb); - - rtc::Buffer packet = sli.Build(); - - EXPECT_THAT(make_tuple(packet.data(), packet.size()), - ElementsAreArray(kPacket)); -} - -TEST(RtcpPacketSliTest, Parse) { - Sli mutable_parsed; - EXPECT_TRUE(test::ParseSinglePacket(kPacket, &mutable_parsed)); - const Sli& parsed = mutable_parsed; // Read values from constant object. - - EXPECT_EQ(kSenderSsrc, parsed.sender_ssrc()); - EXPECT_EQ(kRemoteSsrc, parsed.media_ssrc()); - EXPECT_EQ(1u, parsed.macroblocks().size()); - EXPECT_EQ(kFirstMb, parsed.macroblocks()[0].first()); - EXPECT_EQ(kNumberOfMb, parsed.macroblocks()[0].number()); - EXPECT_EQ(kPictureId, parsed.macroblocks()[0].picture_id()); -} - -TEST(RtcpPacketSliTest, ParseFailsOnTooSmallPacket) { - Sli sli; - sli.SetSenderSsrc(kSenderSsrc); - sli.SetMediaSsrc(kRemoteSsrc); - sli.AddPictureId(kPictureId, kFirstMb, kNumberOfMb); - - rtc::Buffer packet = sli.Build(); - packet[3]--; // Decrease size by 1 word (4 bytes). - packet.SetSize(packet.size() - 4); - - EXPECT_FALSE(test::ParseSinglePacket(packet, &sli)); -} - -} // namespace webrtc diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc index 80d015803a..b5e0d9a18e 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -33,10 +33,8 @@ #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" @@ -66,8 +64,6 @@ struct RTCPReceiver::PacketInformation { std::vector nack_sequence_numbers; ReportBlockList report_blocks; int64_t rtt_ms = 0; - uint8_t sli_picture_id = 0; - uint64_t rpsi_picture_id = 0; uint32_t receiver_estimated_max_bitrate_bps = 0; std::unique_ptr transport_feedback; rtc::Optional target_bitrate_allocation; @@ -359,12 +355,6 @@ bool RTCPReceiver::ParseCompoundPacket(const uint8_t* packet_begin, case rtcp::Pli::kFeedbackMessageType: HandlePli(rtcp_block, packet_information); break; - case rtcp::Sli::kFeedbackMessageType: - HandleSli(rtcp_block, packet_information); - break; - case rtcp::Rpsi::kFeedbackMessageType: - HandleRpsi(rtcp_block, packet_information); - break; case rtcp::Fir::kFeedbackMessageType: HandleFir(rtcp_block, packet_information); break; @@ -839,35 +829,6 @@ void RTCPReceiver::HandleSrReq(const CommonHeader& rtcp_block, packet_information->packet_type_flags |= kRtcpSrReq; } -void RTCPReceiver::HandleSli(const CommonHeader& rtcp_block, - PacketInformation* packet_information) { - rtcp::Sli sli; - if (!sli.Parse(rtcp_block)) { - ++num_skipped_packets_; - return; - } - - for (const rtcp::Sli::Macroblocks& item : sli.macroblocks()) { - // In theory there could be multiple slices lost. - // Received signal that we need to refresh a slice. - packet_information->packet_type_flags |= kRtcpSli; - packet_information->sli_picture_id = item.picture_id(); - } -} - -void RTCPReceiver::HandleRpsi(const CommonHeader& rtcp_block, - PacketInformation* packet_information) { - rtcp::Rpsi rpsi; - if (!rpsi.Parse(rtcp_block)) { - ++num_skipped_packets_; - return; - } - - // Received signal that we have a confirmed reference picture. - packet_information->packet_type_flags |= kRtcpRpsi; - packet_information->rpsi_picture_id = rpsi.picture_id(); -} - void RTCPReceiver::HandlePsfbApp(const CommonHeader& rtcp_block, PacketInformation* packet_information) { rtcp::Remb remb; @@ -1003,14 +964,6 @@ void RTCPReceiver::TriggerCallbacksFromRtcpPacket( } rtcp_intra_frame_observer_->OnReceivedIntraFrameRequest(local_ssrc); } - if (packet_information.packet_type_flags & kRtcpSli) { - rtcp_intra_frame_observer_->OnReceivedSLI( - local_ssrc, packet_information.sli_picture_id); - } - if (packet_information.packet_type_flags & kRtcpRpsi) { - rtcp_intra_frame_observer_->OnReceivedRPSI( - local_ssrc, packet_information.rpsi_picture_id); - } } if (rtcp_bandwidth_observer_) { RTC_DCHECK(!receiver_only_); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h index c64e95d882..1c657a2fc4 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h @@ -182,14 +182,6 @@ class RTCPReceiver { PacketInformation* packet_information) EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); - void HandleSli(const rtcp::CommonHeader& rtcp_block, - PacketInformation* packet_information) - EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); - - void HandleRpsi(const rtcp::CommonHeader& rtcp_block, - PacketInformation* packet_information) - EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); - void HandlePsfbApp(const rtcp::CommonHeader& rtcp_block, PacketInformation* packet_information) EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc index c3ba79d2fc..4b0255f23b 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc @@ -28,10 +28,8 @@ #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" @@ -65,8 +63,6 @@ class MockRtcpPacketTypeCounterObserver : public RtcpPacketTypeCounterObserver { class MockRtcpIntraFrameObserver : public RtcpIntraFrameObserver { public: MOCK_METHOD1(OnReceivedIntraFrameRequest, void(uint32_t)); - MOCK_METHOD2(OnReceivedSLI, void(uint32_t, uint8_t)); - MOCK_METHOD2(OnReceivedRPSI, void(uint32_t, uint64_t)); }; class MockRtcpCallbackImpl : public RtcpStatisticsCallback { @@ -176,60 +172,6 @@ TEST_F(RtcpReceiverTest, InvalidFeedbackPacketIsIgnored) { InjectRtcpPacket(bad_packet); } -TEST_F(RtcpReceiverTest, RpsiWithFractionalPaddingIsIgnored) { - // Padding size represent fractional number of bytes. - const uint8_t kPaddingSizeBits = 0x0b; - // clang-format off - const uint8_t bad_packet[] = {0x80 | rtcp::Rpsi::kFeedbackMessageType, - rtcp::Rpsi::kPacketType, 0, 3, - 0x12, 0x34, 0x56, 0x78, - 0x98, 0x76, 0x54, 0x32, - kPaddingSizeBits, 0x00, 0x00, 0x00}; - // clang-format on - EXPECT_CALL(intra_frame_observer_, OnReceivedRPSI(_, _)).Times(0); - InjectRtcpPacket(bad_packet); -} - -TEST_F(RtcpReceiverTest, RpsiWithTooLargePaddingIsIgnored) { - // Padding size exceeds packet size. - const uint8_t kPaddingSizeBits = 0xa8; - // clang-format off - const uint8_t bad_packet[] = {0x80 | rtcp::Rpsi::kFeedbackMessageType, - rtcp::Rpsi::kPacketType, 0, 3, - 0x12, 0x34, 0x56, 0x78, - 0x98, 0x76, 0x54, 0x32, - kPaddingSizeBits, 0x00, 0x00, 0x00}; - // clang-format on - EXPECT_CALL(intra_frame_observer_, OnReceivedRPSI(_, _)).Times(0); - InjectRtcpPacket(bad_packet); -} - -// With parsing using rtcp classes this test will make no sense. -// With current stateful parser this test was failing. -TEST_F(RtcpReceiverTest, TwoHalfValidRpsiAreIgnored) { - // clang-format off - const uint8_t bad_packet[] = {0x80 | rtcp::Rpsi::kFeedbackMessageType, - rtcp::Rpsi::kPacketType, 0, 2, - 0x12, 0x34, 0x56, 0x78, - 0x98, 0x76, 0x54, 0x32, - 0x80 | rtcp::Rpsi::kFeedbackMessageType, - rtcp::Rpsi::kPacketType, 0, 2, - 0x12, 0x34, 0x56, 0x78, - 0x98, 0x76, 0x54, 0x32}; - // clang-format on - EXPECT_CALL(intra_frame_observer_, OnReceivedRPSI(_, _)).Times(0); - InjectRtcpPacket(bad_packet); -} - -TEST_F(RtcpReceiverTest, InjectRpsiPacket) { - const uint64_t kPictureId = 0x123456789; - rtcp::Rpsi rpsi; - rpsi.SetPictureId(kPictureId); - - EXPECT_CALL(intra_frame_observer_, OnReceivedRPSI(_, kPictureId)); - InjectRtcpPacket(rpsi); -} - TEST_F(RtcpReceiverTest, InjectSrPacket) { RTCPSenderInfo info; EXPECT_EQ(-1, rtcp_receiver_.SenderInfoReceived(&info)); @@ -684,15 +626,6 @@ TEST_F(RtcpReceiverTest, FirPacketNotToUsIgnored) { InjectRtcpPacket(fir); } -TEST_F(RtcpReceiverTest, InjectSliPacket) { - const uint8_t kPictureId = 40; - rtcp::Sli sli; - sli.AddPictureId(kPictureId); - - EXPECT_CALL(intra_frame_observer_, OnReceivedSLI(_, kPictureId)); - InjectRtcpPacket(sli); -} - TEST_F(RtcpReceiverTest, ExtendedReportsPacketWithZeroReportBlocksIgnored) { rtcp::ExtendedReports xr; xr.SetSenderSsrc(kSenderSsrc); diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h index 5d0505816e..57f66559a5 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h @@ -26,7 +26,6 @@ enum { RTCP_MAX_REPORT_BLOCKS = 31 }; // RFC 3550 page 37 enum { kRtcpAppCode_DATA_SIZE = 32 * 4 }; // multiple of 4, this is not a limitation of the size -enum { RTCP_RPSI_DATA_SIZE = 30 }; enum { RTCP_NUMBER_OF_SR = 60 }; enum { MAX_NUMBER_OF_TEMPORAL_ID = 8 }; // RFC diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc index 977138e215..fab92316cf 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc @@ -25,9 +25,6 @@ namespace webrtc { namespace { -const uint64_t kTestPictureId = 12345678; -const uint8_t kSliPictureId = 156; - class RtcpCallback : public RtcpIntraFrameObserver { public: void SetModule(RtpRtcp* module) { @@ -38,14 +35,6 @@ class RtcpCallback : public RtcpIntraFrameObserver { virtual void OnLipSyncUpdate(const int32_t id, const int32_t audioVideoOffset) {} virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) {} - virtual void OnReceivedSLI(uint32_t ssrc, - uint8_t pictureId) { - EXPECT_EQ(kSliPictureId & 0x3f, pictureId); - } - virtual void OnReceivedRPSI(uint32_t ssrc, - uint64_t pictureId) { - EXPECT_EQ(kTestPictureId, pictureId); - } private: RtpRtcp* _rtpRtcpModule; diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc index 6ddbaa03d3..b1282c392e 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc @@ -708,10 +708,6 @@ int VP8EncoderImpl::Encode(const VideoFrame& frame, } } } - // The flag modification below (due to forced key frame, RPS, etc.,) for now - // will be the same for all encoders/spatial layers. - // TODO(marpan/holmer): Allow for key frame request to be set per encoder. - bool only_predict_from_key_frame = false; if (send_key_frame) { // Adapt the size of the key frame when in screenshare with 1 temporal // layer. @@ -770,7 +766,7 @@ int VP8EncoderImpl::Encode(const VideoFrame& frame, return WEBRTC_VIDEO_CODEC_ERROR; timestamp_ += duration; // Examines frame timestamps only. - return GetEncodedPartitions(frame, only_predict_from_key_frame); + return GetEncodedPartitions(frame); } // TODO(pbos): Make sure this works for properly for >1 encoders. @@ -805,8 +801,7 @@ void VP8EncoderImpl::PopulateCodecSpecific( CodecSpecificInfo* codec_specific, const vpx_codec_cx_pkt_t& pkt, int stream_idx, - uint32_t timestamp, - bool only_predicting_from_key_frame) { + uint32_t timestamp) { assert(codec_specific != NULL); codec_specific->codecType = kVideoCodecVP8; codec_specific->codec_name = ImplementationName(); @@ -819,16 +814,14 @@ void VP8EncoderImpl::PopulateCodecSpecific( vp8Info->keyIdx = kNoKeyIdx; // TODO(hlundin) populate this vp8Info->nonReference = (pkt.data.frame.flags & VPX_FRAME_IS_DROPPABLE) ? true : false; - bool base_layer_sync_point = (pkt.data.frame.flags & VPX_FRAME_IS_KEY) || - only_predicting_from_key_frame; + bool base_layer_sync_point = pkt.data.frame.flags & VPX_FRAME_IS_KEY; temporal_layers_[stream_idx]->PopulateCodecSpecific(base_layer_sync_point, vp8Info, timestamp); // Prepare next. picture_id_[stream_idx] = (picture_id_[stream_idx] + 1) & 0x7FFF; } -int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image, - bool only_predicting_from_key_frame) { +int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image) { int bw_resolutions_disabled = (encoders_.size() > 1) ? NumStreamsDisabled(send_stream_) : -1; @@ -879,8 +872,7 @@ int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image, encoded_images_[encoder_idx]._frameType = kVideoFrameKey; } PopulateCodecSpecific(&codec_specific, *pkt, stream_idx, - input_image.timestamp(), - only_predicting_from_key_frame); + input_image.timestamp()); break; } } diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h index 7ce06ddc8e..858cf57b15 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.h @@ -81,11 +81,9 @@ class VP8EncoderImpl : public VP8Encoder { void PopulateCodecSpecific(CodecSpecificInfo* codec_specific, const vpx_codec_cx_pkt& pkt, int stream_idx, - uint32_t timestamp, - bool only_predicting_from_key_frame); + uint32_t timestamp); - int GetEncodedPartitions(const VideoFrame& input_image, - bool only_predicting_from_key_frame); + int GetEncodedPartitions(const VideoFrame& input_image); // Set the stream state for stream |stream_idx|. void SetStreamState(bool send_stream, int stream_idx); diff --git a/webrtc/test/rtcp_packet_parser.cc b/webrtc/test/rtcp_packet_parser.cc index b9cf6db1a7..728cb63f50 100644 --- a/webrtc/test/rtcp_packet_parser.cc +++ b/webrtc/test/rtcp_packet_parser.cc @@ -55,12 +55,6 @@ bool RtcpPacketParser::Parse(const void* data, size_t length) { case rtcp::Remb::kFeedbackMessageType: remb_.Parse(header, &sender_ssrc_); break; - case rtcp::Rpsi::kFeedbackMessageType: - rpsi_.Parse(header, &sender_ssrc_); - break; - case rtcp::Sli::kFeedbackMessageType: - sli_.Parse(header, &sender_ssrc_); - break; default: LOG(LS_WARNING) << "Unknown rtcp payload specific feedback type " << header.fmt(); diff --git a/webrtc/test/rtcp_packet_parser.h b/webrtc/test/rtcp_packet_parser.h index ef1fab823d..5dc4e841f8 100644 --- a/webrtc/test/rtcp_packet_parser.h +++ b/webrtc/test/rtcp_packet_parser.h @@ -25,10 +25,8 @@ #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rapid_resync_request.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" -#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" @@ -90,10 +88,8 @@ class RtcpPacketParser { return &receiver_report_; } PacketCounter* remb() { return &remb_; } - PacketCounter* rpsi() { return &rpsi_; } PacketCounter* sdes() { return &sdes_; } PacketCounter* sender_report() { return &sender_report_; } - PacketCounter* sli() { return &sli_; } PacketCounter* tmmbn() { return &tmmbn_; } PacketCounter* tmmbr() { return &tmmbr_; } PacketCounter* transport_feedback() { @@ -112,10 +108,8 @@ class RtcpPacketParser { PacketCounter rrr_; PacketCounter receiver_report_; PacketCounter remb_; - PacketCounter rpsi_; PacketCounter sdes_; PacketCounter sender_report_; - PacketCounter sli_; PacketCounter tmmbn_; PacketCounter tmmbr_; PacketCounter transport_feedback_; diff --git a/webrtc/video/encoder_rtcp_feedback.cc b/webrtc/video/encoder_rtcp_feedback.cc index ec0ac1e928..b6f3fc9203 100644 --- a/webrtc/video/encoder_rtcp_feedback.cc +++ b/webrtc/video/encoder_rtcp_feedback.cc @@ -63,15 +63,4 @@ void EncoderRtcpFeedback::OnReceivedIntraFrameRequest(uint32_t ssrc) { vie_encoder_->OnReceivedIntraFrameRequest(index); } -void EncoderRtcpFeedback::OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) { - RTC_DCHECK(HasSsrc(ssrc)); - - vie_encoder_->OnReceivedSLI(picture_id); -} - -void EncoderRtcpFeedback::OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) { - RTC_DCHECK(HasSsrc(ssrc)); - - vie_encoder_->OnReceivedRPSI(picture_id); -} } // namespace webrtc diff --git a/webrtc/video/encoder_rtcp_feedback.h b/webrtc/video/encoder_rtcp_feedback.h index 4afdcf4c9e..06548d64a9 100644 --- a/webrtc/video/encoder_rtcp_feedback.h +++ b/webrtc/video/encoder_rtcp_feedback.h @@ -27,8 +27,6 @@ class EncoderRtcpFeedback : public RtcpIntraFrameObserver { const std::vector& ssrcs, ViEEncoder* encoder); void OnReceivedIntraFrameRequest(uint32_t ssrc) override; - void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) override; - void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) override; private: bool HasSsrc(uint32_t ssrc); diff --git a/webrtc/video/encoder_rtcp_feedback_unittest.cc b/webrtc/video/encoder_rtcp_feedback_unittest.cc index 1ddf4895a6..1606a59357 100644 --- a/webrtc/video/encoder_rtcp_feedback_unittest.cc +++ b/webrtc/video/encoder_rtcp_feedback_unittest.cc @@ -31,8 +31,6 @@ class MockVieEncoder : public ViEEncoder { ~MockVieEncoder() { Stop(); } MOCK_METHOD1(OnReceivedIntraFrameRequest, void(size_t)); - MOCK_METHOD1(OnReceivedSLI, void(uint8_t picture_id)); - MOCK_METHOD1(OnReceivedRPSI, void(uint64_t picture_id)); }; class VieKeyRequestTest : public ::testing::Test { @@ -60,14 +58,6 @@ class VieKeyRequestTest : public ::testing::Test { TEST_F(VieKeyRequestTest, CreateAndTriggerRequests) { EXPECT_CALL(encoder_, OnReceivedIntraFrameRequest(0)).Times(1); encoder_rtcp_feedback_.OnReceivedIntraFrameRequest(kSsrc); - - const uint8_t sli_picture_id = 3; - EXPECT_CALL(encoder_, OnReceivedSLI(sli_picture_id)).Times(1); - encoder_rtcp_feedback_.OnReceivedSLI(kSsrc, sli_picture_id); - - const uint64_t rpsi_picture_id = 9; - EXPECT_CALL(encoder_, OnReceivedRPSI(rpsi_picture_id)).Times(1); - encoder_rtcp_feedback_.OnReceivedRPSI(kSsrc, rpsi_picture_id); } TEST_F(VieKeyRequestTest, TooManyOnReceivedIntraFrameRequest) { diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc index 19e8df1844..728d37b641 100644 --- a/webrtc/video/vie_encoder.cc +++ b/webrtc/video/vie_encoder.cc @@ -279,10 +279,6 @@ ViEEncoder::ViEEncoder(uint32_t number_of_cores, nack_enabled_(false), last_observed_bitrate_bps_(0), encoder_paused_and_dropped_frame_(false), - has_received_sli_(false), - picture_id_sli_(0), - has_received_rpsi_(false), - picture_id_rpsi_(0), clock_(Clock::GetRealTimeClock()), scale_counter_(kScaleReasonSize, 0), degradation_preference_(DegradationPreference::kMaintainResolution), @@ -664,28 +660,6 @@ void ViEEncoder::SendStatistics(uint32_t bit_rate, uint32_t frame_rate) { stats_proxy_->OnEncoderStatsUpdate(frame_rate, bit_rate); } -// TODO(nisse): Delete. -void ViEEncoder::OnReceivedSLI(uint8_t picture_id) { - if (!encoder_queue_.IsCurrent()) { - encoder_queue_.PostTask([this, picture_id] { OnReceivedSLI(picture_id); }); - return; - } - RTC_DCHECK_RUN_ON(&encoder_queue_); - picture_id_sli_ = picture_id; - has_received_sli_ = true; -} - -// TODO(nisse): Delete. -void ViEEncoder::OnReceivedRPSI(uint64_t picture_id) { - if (!encoder_queue_.IsCurrent()) { - encoder_queue_.PostTask([this, picture_id] { OnReceivedRPSI(picture_id); }); - return; - } - RTC_DCHECK_RUN_ON(&encoder_queue_); - picture_id_rpsi_ = picture_id; - has_received_rpsi_ = true; -} - void ViEEncoder::OnReceivedIntraFrameRequest(size_t stream_index) { if (!encoder_queue_.IsCurrent()) { encoder_queue_.PostTask( diff --git a/webrtc/video/vie_encoder.h b/webrtc/video/vie_encoder.h index c0b80baadd..2d770db25e 100644 --- a/webrtc/video/vie_encoder.h +++ b/webrtc/video/vie_encoder.h @@ -106,8 +106,6 @@ class ViEEncoder : public rtc::VideoSinkInterface, // virtual to test EncoderStateFeedback with mocks. virtual void OnReceivedIntraFrameRequest(size_t stream_index); - virtual void OnReceivedSLI(uint8_t picture_id); - virtual void OnReceivedRPSI(uint64_t picture_id); void OnBitrateUpdated(uint32_t bitrate_bps, uint8_t fraction_lost, @@ -210,10 +208,6 @@ class ViEEncoder : public rtc::VideoSinkInterface, bool nack_enabled_ ACCESS_ON(&encoder_queue_); uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); - bool has_received_sli_ ACCESS_ON(&encoder_queue_); - uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); - bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); - uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); Clock* const clock_; // Counters used for deciding if the video resolution is currently // restricted, and if so, why.