diff options
Diffstat (limited to 'webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc')
-rw-r--r-- | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index 4c94764ee6..8329f603f9 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -8,13 +8,17 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include <map> +#include <set> + #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "webrtc/common_types.h" -#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" -#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" +#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" +#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" +#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" #include "webrtc/system_wrappers/include/scoped_vector.h" #include "webrtc/test/rtcp_packet_parser.h" @@ -94,7 +98,7 @@ class SendTransport : public Transport, class RtpRtcpModule : public RtcpPacketTypeCounterObserver { public: - RtpRtcpModule(SimulatedClock* clock) + explicit RtpRtcpModule(SimulatedClock* clock) : receive_statistics_(ReceiveStatistics::Create(clock)) { RtpRtcp::Configuration config; config.audio = false; @@ -346,6 +350,27 @@ TEST_F(RtpRtcpImplTest, RttForReceiverOnly) { EXPECT_EQ(2 * kOneWayNetworkDelayMs, receiver_.impl_->rtt_ms()); } +TEST_F(RtpRtcpImplTest, NoSrBeforeMedia) { + // Ignore fake transport delays in this test. + sender_.transport_.SimulateNetworkDelay(0, &clock_); + receiver_.transport_.SimulateNetworkDelay(0, &clock_); + + sender_.impl_->Process(); + EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms); + + // Verify no SR is sent before media has been sent, RR should still be sent + // from the receiving module though. + clock_.AdvanceTimeMilliseconds(2000); + int64_t current_time = clock_.TimeInMilliseconds(); + sender_.impl_->Process(); + receiver_.impl_->Process(); + EXPECT_EQ(-1, sender_.RtcpSent().first_packet_time_ms); + EXPECT_EQ(receiver_.RtcpSent().first_packet_time_ms, current_time); + + SendFrame(&sender_, kBaseLayerTid); + EXPECT_EQ(sender_.RtcpSent().first_packet_time_ms, current_time); +} + TEST_F(RtpRtcpImplTest, RtcpPacketTypeCounter_Nack) { EXPECT_EQ(-1, receiver_.RtcpSent().first_packet_time_ms); EXPECT_EQ(-1, sender_.RtcpReceived().first_packet_time_ms); @@ -522,5 +547,4 @@ TEST_F(RtpRtcpImplTest, UniqueNackRequests) { EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); } - } // namespace webrtc |