Move some tests out from rtp_sender_unittest.

Moves OnSendSideDelayUpdated and OnSendPacketUpdated out from
rtp_sender_unittest and into rtp_sender_egress_unittest and
rtp_rtcp_impl2_unittest. The former test now only tests the logic for
updating send-side-delay stats. The latter is now on a proper
RtpRtcp-level and also verifies that frame timestamps makes it to the
egress (as assumed by the first test).

Bug: webrtc:11340
Change-Id: I784042ad91eb66a4d1eebdbbc625f9522528bfb5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/218502
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33996}
This commit is contained in:
Erik Språng
2021-05-12 15:34:22 +02:00
committed by WebRTC LUCI CQ
parent f154ff20b2
commit bd09a46aa1
3 changed files with 93 additions and 91 deletions

View File

@ -545,95 +545,6 @@ TEST_P(RtpSenderTest, PaddingAlwaysAllowedOnAudio) {
EXPECT_EQ(kMinPaddingSize, GenerateAndSendPadding(kMinPaddingSize - 5));
}
TEST_P(RtpSenderTestWithoutPacer, OnSendSideDelayUpdated) {
StrictMock<MockSendSideDelayObserver> send_side_delay_observer_;
RtpRtcpInterface::Configuration config;
config.clock = clock_;
config.outgoing_transport = &transport_;
config.local_media_ssrc = kSsrc;
config.send_side_delay_observer = &send_side_delay_observer_;
config.event_log = &mock_rtc_event_log_;
rtp_sender_context_ =
std::make_unique<RtpSenderContext>(config, &time_controller_);
FieldTrialBasedConfig field_trials;
RTPSenderVideo::Config video_config;
video_config.clock = clock_;
video_config.rtp_sender = rtp_sender();
video_config.field_trials = &field_trials;
RTPSenderVideo rtp_sender_video(video_config);
const uint8_t kPayloadType = 127;
const absl::optional<VideoCodecType> kCodecType =
VideoCodecType::kVideoCodecGeneric;
const uint32_t kCaptureTimeMsToRtpTimestamp = 90; // 90 kHz clock
RTPVideoHeader video_header;
// Send packet with 10 ms send-side delay. The average, max and total should
// be 10 ms.
EXPECT_CALL(send_side_delay_observer_,
SendSideDelayUpdated(10, 10, 10, kSsrc))
.Times(1);
int64_t capture_time_ms = clock_->TimeInMilliseconds();
time_controller_.AdvanceTime(TimeDelta::Millis(10));
video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_TRUE(rtp_sender_video.SendVideo(
kPayloadType, kCodecType, capture_time_ms * kCaptureTimeMsToRtpTimestamp,
capture_time_ms, kPayloadData, video_header,
kDefaultExpectedRetransmissionTimeMs));
// Send another packet with 20 ms delay. The average, max and total should be
// 15, 20 and 30 ms respectively.
EXPECT_CALL(send_side_delay_observer_,
SendSideDelayUpdated(15, 20, 30, kSsrc))
.Times(1);
time_controller_.AdvanceTime(TimeDelta::Millis(10));
video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_TRUE(rtp_sender_video.SendVideo(
kPayloadType, kCodecType, capture_time_ms * kCaptureTimeMsToRtpTimestamp,
capture_time_ms, kPayloadData, video_header,
kDefaultExpectedRetransmissionTimeMs));
// Send another packet at the same time, which replaces the last packet.
// Since this packet has 0 ms delay, the average is now 5 ms and max is 10 ms.
// The total counter stays the same though.
// TODO(terelius): Is is not clear that this is the right behavior.
EXPECT_CALL(send_side_delay_observer_, SendSideDelayUpdated(5, 10, 30, kSsrc))
.Times(1);
capture_time_ms = clock_->TimeInMilliseconds();
video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_TRUE(rtp_sender_video.SendVideo(
kPayloadType, kCodecType, capture_time_ms * kCaptureTimeMsToRtpTimestamp,
capture_time_ms, kPayloadData, video_header,
kDefaultExpectedRetransmissionTimeMs));
// Send a packet 1 second later. The earlier packets should have timed
// out, so both max and average should be the delay of this packet. The total
// keeps increasing.
time_controller_.AdvanceTime(TimeDelta::Millis(1000));
capture_time_ms = clock_->TimeInMilliseconds();
time_controller_.AdvanceTime(TimeDelta::Millis(1));
EXPECT_CALL(send_side_delay_observer_, SendSideDelayUpdated(1, 1, 31, kSsrc))
.Times(1);
video_header.frame_type = VideoFrameType::kVideoFrameKey;
EXPECT_TRUE(rtp_sender_video.SendVideo(
kPayloadType, kCodecType, capture_time_ms * kCaptureTimeMsToRtpTimestamp,
capture_time_ms, kPayloadData, video_header,
kDefaultExpectedRetransmissionTimeMs));
}
TEST_P(RtpSenderTestWithoutPacer, OnSendPacketUpdated) {
EXPECT_TRUE(rtp_sender()->RegisterRtpHeaderExtension(
TransportSequenceNumber::kUri, kTransportSequenceNumberExtensionId));
EXPECT_CALL(send_packet_observer_,
OnSendPacket(kTransportSequenceNumber, _, _))
.Times(1);
SendGenericPacket();
}
TEST_P(RtpSenderTest, SendsPacketsWithTransportSequenceNumber) {
RtpRtcpInterface::Configuration config;
config.clock = clock_;