Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc

Issue 2960363002: Implement RTP keepalive in native stack. (Closed)
Patch Set: Cleanup Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | webrtc/video/replay.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index bcfa650c02dbfd2755462281eb6695a10776cdce..dabafd674a818e93656ee6999538426c9641263b 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -57,6 +57,7 @@ const uint8_t kPayloadData[] = {47, 11, 32, 93, 89};
using ::testing::_;
using ::testing::ElementsAreArray;
+using ::testing::Invoke;
uint64_t ConvertMsToAbsSendTime(int64_t time_ms) {
return (((time_ms << 18) + 500) / 1000) & 0x00ffffff;
@@ -1711,6 +1712,40 @@ TEST_P(RtpSenderTest, SendAudioPadding) {
rtp_sender_->TimeToSendPadding(kMinPaddingSize - 5, PacedPacketInfo()));
}
+TEST_P(RtpSenderTest, SendsKeepAlive) {
+ MockTransport transport;
+ rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, &mock_rtc_event_log_, nullptr,
+ &retransmission_rate_limiter_, nullptr));
+ rtp_sender_->SetSendPayloadType(kPayload);
+ rtp_sender_->SetSequenceNumber(kSeqNum);
+ rtp_sender_->SetTimestampOffset(0);
+ rtp_sender_->SetSSRC(kSsrc);
+
+ const uint8_t kKeepalivePayloadType = 20;
+ RTC_CHECK_NE(kKeepalivePayloadType, kPayload);
+
+ EXPECT_CALL(transport, SendRtp(_, _, _))
+ .WillOnce(
+ Invoke([&kKeepalivePayloadType](const uint8_t* packet, size_t len,
+ const PacketOptions& options) {
+ webrtc::RTPHeader rtp_header;
+ RtpUtility::RtpHeaderParser parser(packet, len);
+ EXPECT_TRUE(parser.Parse(&rtp_header, nullptr));
+ EXPECT_FALSE(rtp_header.markerBit);
+ EXPECT_EQ(0U, rtp_header.paddingLength);
+ EXPECT_EQ(kKeepalivePayloadType, rtp_header.payloadType);
+ EXPECT_EQ(kSeqNum, rtp_header.sequenceNumber);
+ EXPECT_EQ(kSsrc, rtp_header.ssrc);
+ EXPECT_EQ(0u, len - rtp_header.headerLength);
+ return true;
+ }));
+
+ rtp_sender_->SendKeepAlive(kKeepalivePayloadType);
+ EXPECT_EQ(kSeqNum + 1, rtp_sender_->SequenceNumber());
+}
+
INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead,
RtpSenderTest,
::testing::Bool());
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | webrtc/video/replay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698