Minor fixes and refactoring for RtpTransport until the Demux.

This change fixes some inefficiencies and quirks in the code that
originates in RtpTransport leading up to the demux.

This work is in preparation for more refactoring of the Demux stage
onwards.

Bug: webrtc:10297
Change-Id: I7b8f00134657d62c722939618a55a91a2b6040bd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128220
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27185}
This commit is contained in:
Amit Hilbuch
2019-03-18 12:33:43 -07:00
committed by Commit Bot
parent 342989d498
commit edd2054562
8 changed files with 113 additions and 69 deletions

View File

@ -79,8 +79,18 @@ static uint8_t kRtpMsgWithAbsSendTimeExtension[] = {
// Index of AbsSendTimeExtn data in message |kRtpMsgWithAbsSendTimeExtension|.
static const int kAstIndexInRtpMsg = 21;
static const rtc::ArrayView<const char> kPcmuFrameArrayView =
rtc::MakeArrayView(reinterpret_cast<const char*>(kPcmuFrame),
sizeof(kPcmuFrame));
static const rtc::ArrayView<const char> kRtcpReportArrayView =
rtc::MakeArrayView(reinterpret_cast<const char*>(kRtcpReport),
sizeof(kRtcpReport));
static const rtc::ArrayView<const char> kInvalidPacketArrayView =
rtc::MakeArrayView(reinterpret_cast<const char*>(kInvalidPacket),
sizeof(kInvalidPacket));
TEST(RtpUtilsTest, GetRtp) {
EXPECT_TRUE(IsRtpPacket(kPcmuFrame, sizeof(kPcmuFrame)));
EXPECT_TRUE(IsRtpPacket(kPcmuFrameArrayView));
int pt;
EXPECT_TRUE(GetRtpPayloadType(kPcmuFrame, sizeof(kPcmuFrame), &pt));
@ -344,4 +354,11 @@ TEST(RtpUtilsTest, ApplyPacketOptionsWithAuthParamsAndAbsSendTime) {
sizeof(kExpectedTimestamp)));
}
TEST(RtpUtilsTest, InferRtpPacketType) {
EXPECT_EQ(RtpPacketType::kRtp, InferRtpPacketType(kPcmuFrameArrayView));
EXPECT_EQ(RtpPacketType::kRtcp, InferRtpPacketType(kRtcpReportArrayView));
EXPECT_EQ(RtpPacketType::kUnknown,
InferRtpPacketType(kInvalidPacketArrayView));
}
} // namespace cricket