Split LogRtpHeader and LogRtcpPacket into separate versions for incoming and outgoing packets.
Change LogIncomingRtcpPacket and LogOutgoingRtcpPacket to take ArrayView<uint8_t>. Split LogSessionAndReadBack into three functions and create class to share state between them. Split VerifyRtpEvent into one incoming and one outgoing version. Originally uploaded as https://codereview.webrtc.org/2997973002/ Bug: webrtc:8111 Change-Id: I22bdc35163bef60bc8293679226b19e41e8f49b3 Reviewed-on: https://webrtc-review.googlesource.com/5020 Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Elad Alon <eladalon@webrtc.org> Commit-Queue: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20063}
This commit is contained in:
committed by
Commit Bot
parent
5117b04787
commit
440216fcf3
@ -99,7 +99,8 @@ class PacketContainer : public rtcp::CompoundPacket,
|
||||
if (transport_->SendRtcp(data, length)) {
|
||||
bytes_sent_ += length;
|
||||
if (event_log_) {
|
||||
event_log_->LogRtcpPacket(kOutgoingPacket, data, length);
|
||||
event_log_->LogOutgoingRtcpPacket(
|
||||
rtc::ArrayView<const uint8_t>(data, length));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -962,7 +963,8 @@ bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) {
|
||||
void OnPacketReady(uint8_t* data, size_t length) override {
|
||||
if (transport_->SendRtcp(data, length)) {
|
||||
if (event_log_) {
|
||||
event_log_->LogRtcpPacket(kOutgoingPacket, data, length);
|
||||
event_log_->LogOutgoingRtcpPacket(
|
||||
rtc::ArrayView<const uint8_t>(data, length));
|
||||
}
|
||||
} else {
|
||||
send_failure_ = true;
|
||||
|
||||
@ -644,8 +644,7 @@ bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet,
|
||||
? static_cast<int>(packet.size())
|
||||
: -1;
|
||||
if (event_log_ && bytes_sent > 0) {
|
||||
event_log_->LogRtpHeader(kOutgoingPacket, packet.data(), packet.size(),
|
||||
pacing_info.probe_cluster_id);
|
||||
event_log_->LogOutgoingRtpHeader(packet, pacing_info.probe_cluster_id);
|
||||
}
|
||||
}
|
||||
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
|
||||
|
||||
@ -530,8 +530,7 @@ TEST_P(RtpSenderTestWithoutPacer, WritesTimestampToTimingExtension) {
|
||||
TEST_P(RtpSenderTest, TrafficSmoothingWithExtensions) {
|
||||
EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
|
||||
kSsrc, kSeqNum, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _));
|
||||
|
||||
rtp_sender_->SetStorePacketsStatus(true, 10);
|
||||
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
|
||||
@ -575,8 +574,7 @@ TEST_P(RtpSenderTest, TrafficSmoothingWithExtensions) {
|
||||
TEST_P(RtpSenderTest, TrafficSmoothingRetransmits) {
|
||||
EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
|
||||
kSsrc, kSeqNum, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _));
|
||||
|
||||
rtp_sender_->SetStorePacketsStatus(true, 10);
|
||||
EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
|
||||
@ -629,9 +627,7 @@ TEST_P(RtpSenderTest, SendPadding) {
|
||||
// Make all (non-padding) packets go to send queue.
|
||||
EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority,
|
||||
kSsrc, kSeqNum, _, _, _));
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(1 + 4 + 1);
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _)).Times(1 + 4 + 1);
|
||||
|
||||
uint16_t seq_num = kSeqNum;
|
||||
uint32_t timestamp = kTimestamp;
|
||||
@ -830,8 +826,7 @@ TEST_P(RtpSenderTest, SendRedundantPayloads) {
|
||||
EXPECT_CALL(mock_paced_sender_,
|
||||
InsertPacket(RtpPacketSender::kNormalPriority, kSsrc, _, _, _, _))
|
||||
.Times(kNumPayloadSizes);
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _))
|
||||
.Times(kNumPayloadSizes);
|
||||
|
||||
// Send 10 packets of increasing size.
|
||||
@ -844,8 +839,7 @@ TEST_P(RtpSenderTest, SendRedundantPayloads) {
|
||||
fake_clock_.AdvanceTimeMilliseconds(33);
|
||||
}
|
||||
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _))
|
||||
.Times(::testing::AtLeast(4));
|
||||
|
||||
// The amount of padding to send it too small to send a payload packet.
|
||||
@ -941,9 +935,7 @@ TEST_P(RtpSenderTest, SendFlexfecPackets) {
|
||||
kFlexfecSsrc, _, _, _, false))
|
||||
.WillOnce(testing::SaveArg<2>(&flexfec_seq_num));
|
||||
SendGenericPayload();
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(2);
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _)).Times(2);
|
||||
EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum,
|
||||
fake_clock_.TimeInMilliseconds(),
|
||||
false, PacedPacketInfo()));
|
||||
@ -1018,9 +1010,7 @@ TEST_P(RtpSenderTest, NoFlexfecForTimingFrames) {
|
||||
sizeof(kPayloadData), nullptr, &video_header, nullptr,
|
||||
kDefaultExpectedRetransmissionTimeMs));
|
||||
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(1);
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _)).Times(1);
|
||||
EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum,
|
||||
fake_clock_.TimeInMilliseconds(),
|
||||
false, PacedPacketInfo()));
|
||||
@ -1044,9 +1034,7 @@ TEST_P(RtpSenderTest, NoFlexfecForTimingFrames) {
|
||||
kPayloadData, sizeof(kPayloadData), nullptr, &video_header, nullptr,
|
||||
kDefaultExpectedRetransmissionTimeMs));
|
||||
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(2);
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _)).Times(2);
|
||||
EXPECT_TRUE(rtp_sender_->TimeToSendPacket(kMediaSsrc, kSeqNum + 1,
|
||||
fake_clock_.TimeInMilliseconds(),
|
||||
false, PacedPacketInfo()));
|
||||
@ -1092,9 +1080,7 @@ TEST_P(RtpSenderTestWithoutPacer, SendFlexfecPackets) {
|
||||
params.fec_mask_type = kFecMaskRandom;
|
||||
rtp_sender_->SetFecParameters(params, params);
|
||||
|
||||
EXPECT_CALL(mock_rtc_event_log_,
|
||||
LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _))
|
||||
.Times(2);
|
||||
EXPECT_CALL(mock_rtc_event_log_, LogOutgoingRtpHeader(_, _)).Times(2);
|
||||
SendGenericPayload();
|
||||
ASSERT_EQ(2, transport_.packets_sent());
|
||||
const RtpPacketReceived& media_packet = transport_.sent_packets_[0];
|
||||
|
||||
Reference in New Issue
Block a user