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:
committed by
WebRTC LUCI CQ
parent
f154ff20b2
commit
bd09a46aa1
@ -31,6 +31,7 @@
|
||||
#include "test/run_loop.h"
|
||||
#include "test/time_controller/simulated_time_controller.h"
|
||||
|
||||
using ::testing::AllOf;
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::Eq;
|
||||
using ::testing::Field;
|
||||
@ -152,8 +153,17 @@ class FieldTrialConfig : public WebRtcKeyValueConfig {
|
||||
double max_padding_factor_;
|
||||
};
|
||||
|
||||
class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
class RtpRtcpModule : public RtcpPacketTypeCounterObserver,
|
||||
public SendPacketObserver {
|
||||
public:
|
||||
struct SentPacket {
|
||||
SentPacket(uint16_t packet_id, int64_t capture_time_ms, uint32_t ssrc)
|
||||
: packet_id(packet_id), capture_time_ms(capture_time_ms), ssrc(ssrc) {}
|
||||
uint16_t packet_id;
|
||||
int64_t capture_time_ms;
|
||||
uint32_t ssrc;
|
||||
};
|
||||
|
||||
RtpRtcpModule(TimeController* time_controller,
|
||||
bool is_sender,
|
||||
const FieldTrialConfig& trials)
|
||||
@ -182,6 +192,16 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
counter_map_[ssrc] = packet_counter;
|
||||
}
|
||||
|
||||
void OnSendPacket(uint16_t packet_id,
|
||||
int64_t capture_time_ms,
|
||||
uint32_t ssrc) override {
|
||||
last_sent_packet_.emplace(packet_id, capture_time_ms, ssrc);
|
||||
}
|
||||
|
||||
absl::optional<SentPacket> last_sent_packet() const {
|
||||
return last_sent_packet_;
|
||||
}
|
||||
|
||||
RtcpPacketTypeCounter RtcpSent() {
|
||||
// RTCP counters for remote SSRC.
|
||||
return counter_map_[is_sender_ ? kReceiverSsrc : kSenderSsrc];
|
||||
@ -221,6 +241,7 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
config.need_rtp_packet_infos = true;
|
||||
config.non_sender_rtt_measurement = true;
|
||||
config.field_trials = &trials_;
|
||||
config.send_packet_observer = this;
|
||||
|
||||
impl_.reset(new ModuleRtpRtcpImpl2(config));
|
||||
impl_->SetRemoteSSRC(is_sender_ ? kReceiverSsrc : kSenderSsrc);
|
||||
@ -229,6 +250,7 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
|
||||
|
||||
TimeController* const time_controller_;
|
||||
std::map<uint32_t, RtcpPacketTypeCounter> counter_map_;
|
||||
absl::optional<SentPacket> last_sent_packet_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@ -915,6 +937,23 @@ TEST_P(RtpRtcpImpl2Test, AssignsAbsoluteSendTime) {
|
||||
EXPECT_NE(sender_.last_packet().GetExtension<AbsoluteSendTime>(), 0u);
|
||||
}
|
||||
|
||||
TEST_P(RtpRtcpImpl2Test, PropagatesSentPacketInfo) {
|
||||
sender_.RegisterHeaderExtension(TransportSequenceNumber::kUri,
|
||||
kTransportSequenceNumberExtensionId);
|
||||
int64_t now_ms = time_controller_.GetClock()->TimeInMilliseconds();
|
||||
const int kCaptureTimeMsToRtpTimestamp = 90; // 90 kHz clock
|
||||
EXPECT_TRUE(SendFrame(&sender_, sender_video_.get(), kBaseLayerTid,
|
||||
/*timestamp=*/kCaptureTimeMsToRtpTimestamp * now_ms));
|
||||
EXPECT_THAT(
|
||||
sender_.last_sent_packet(),
|
||||
Optional(
|
||||
AllOf(Field(&RtpRtcpModule::SentPacket::packet_id,
|
||||
Eq(sender_.last_packet()
|
||||
.GetExtension<TransportSequenceNumber>())),
|
||||
Field(&RtpRtcpModule::SentPacket::capture_time_ms, Eq(now_ms)),
|
||||
Field(&RtpRtcpModule::SentPacket::ssrc, Eq(kSenderSsrc)))));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(WithAndWithoutOverhead,
|
||||
RtpRtcpImpl2Test,
|
||||
::testing::Values(TestConfig{false},
|
||||
|
||||
Reference in New Issue
Block a user