Reland "Avoid sending empty receiver reports with RtcpTransceiver"

This reverts commit 48420fa947cea4c618d51dc5f87908765a3a69db.

Reason for revert: downstream unittests adjusted

Original change's description:
> Revert "Avoid sending empty receiver reports with RtcpTransceiver"
>
> This reverts commit e5f1a3992e3bbfa0445b90f317576c8229524d74.
>
> Reason for revert: Speculative revert due to failing downstream unittest.
>
> Original change's description:
> > Avoid sending empty receiver reports with RtcpTransceiver
> >
> > Bug: None
> > Change-Id: Ia017c2df285febefb72ba88ba43366455bde5a78
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222402
> > Reviewed-by: Per Kjellander <perkj@webrtc.org>
> > Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#34281}
>
> TBR=danilchap@webrtc.org,perkj@webrtc.org,webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: I895317ad0381756e97e501a36d6440f83a68b6f8
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: None
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222440
> Reviewed-by: Björn Terelius <terelius@webrtc.org>
> Commit-Queue: Björn Terelius <terelius@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#34284}

# Not skipping CQ checks because this is a reland.

Bug: None
Change-Id: I3481b9b12ddabaef7303ba80e9cd885930988caa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222600
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34291}
This commit is contained in:
Danil Chapovalov
2021-06-15 11:47:16 +00:00
committed by WebRTC LUCI CQ
parent 7a2db8acbe
commit be53049555
2 changed files with 47 additions and 2 deletions

View File

@ -38,6 +38,7 @@ namespace {
using ::testing::_;
using ::testing::ElementsAre;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::SizeIs;
using ::testing::StrictMock;
@ -392,6 +393,47 @@ TEST(RtcpTransceiverImplTest, SendsMinimalCompoundPacket) {
EXPECT_EQ(rtcp_parser.sdes()->chunks()[0].cname, config.cname);
}
TEST(RtcpTransceiverImplTest, AvoidsEmptyPacketsInReducedMode) {
MockTransport transport;
EXPECT_CALL(transport, SendRtcp).Times(0);
NiceMock<MockReceiveStatisticsProvider> receive_statistics;
SimulatedClock clock(0);
RtcpTransceiverConfig config = DefaultTestConfig();
config.clock = &clock;
config.outgoing_transport = &transport;
config.rtcp_mode = webrtc::RtcpMode::kReducedSize;
config.schedule_periodic_compound_packets = false;
config.receive_statistics = &receive_statistics;
RtcpTransceiverImpl rtcp_transceiver(config);
rtcp_transceiver.SendCompoundPacket();
}
TEST(RtcpTransceiverImplTest, AvoidsEmptyReceiverReportsInReducedMode) {
RtcpPacketParser rtcp_parser;
RtcpParserTransport transport(&rtcp_parser);
NiceMock<MockReceiveStatisticsProvider> receive_statistics;
SimulatedClock clock(0);
RtcpTransceiverConfig config = DefaultTestConfig();
config.clock = &clock;
config.outgoing_transport = &transport;
config.rtcp_mode = webrtc::RtcpMode::kReducedSize;
config.schedule_periodic_compound_packets = false;
config.receive_statistics = &receive_statistics;
// Set it to produce something (RRTR) in the "periodic" rtcp packets.
config.non_sender_rtt_measurement = true;
RtcpTransceiverImpl rtcp_transceiver(config);
// Rather than waiting for the right time to produce the periodic packet,
// trigger it manually.
rtcp_transceiver.SendCompoundPacket();
EXPECT_EQ(rtcp_parser.receiver_report()->num_packets(), 0);
EXPECT_GT(rtcp_parser.xr()->num_packets(), 0);
}
TEST(RtcpTransceiverImplTest, SendsNoRembInitially) {
const uint32_t kSenderSsrc = 12345;
SimulatedClock clock(0);