1 /*
2  *  Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "media/base/rtp_utils.h"
12 
13 #include <string.h>
14 
15 #include <cstdint>
16 #include <vector>
17 
18 #include "media/base/fake_rtp.h"
19 #include "rtc_base/async_packet_socket.h"
20 #include "test/gtest.h"
21 
22 namespace cricket {
23 
24 static const uint8_t kRtpPacketWithMarker[] = {
25     0x80, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
26 // 3 CSRCs (0x01020304, 0x12345678, 0xAABBCCDD)
27 // Extension (0xBEDE, 0x1122334455667788)
28 static const uint8_t kRtpPacketWithMarkerAndCsrcAndExtension[] = {
29     0x93, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
30     0x01, 0x02, 0x03, 0x04, 0x12, 0x34, 0x56, 0x78, 0xAA, 0xBB, 0xCC, 0xDD,
31     0xBE, 0xDE, 0x00, 0x02, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
32 static const uint8_t kInvalidPacket[] = {0x80, 0x00};
33 static const uint8_t kInvalidPacketWithCsrc[] = {
34     0x83, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
35     0x01, 0x02, 0x03, 0x04, 0x12, 0x34, 0x56, 0x78, 0xAA, 0xBB, 0xCC};
36 static const uint8_t kInvalidPacketWithCsrcAndExtension1[] = {
37     0x93, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
38     0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x12, 0x34,
39     0x56, 0x78, 0xAA, 0xBB, 0xCC, 0xDD, 0xBE, 0xDE, 0x00};
40 static const uint8_t kInvalidPacketWithCsrcAndExtension2[] = {
41     0x93, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
42     0x01, 0x02, 0x03, 0x04, 0x12, 0x34, 0x56, 0x78, 0xAA, 0xBB, 0xCC, 0xDD,
43     0xBE, 0xDE, 0x00, 0x02, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77};
44 
45 // PT = 206, FMT = 1, Sender SSRC  = 0x1111, Media SSRC = 0x1111
46 // No FCI information is needed for PLI.
47 static const uint8_t kNonCompoundRtcpPliFeedbackPacket[] = {
48     0x81, 0xCE, 0x00, 0x0C, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x11, 0x11};
49 
50 // Packet has only mandatory fixed RTCP header
51 // PT = 204, SSRC = 0x1111
52 static const uint8_t kNonCompoundRtcpAppPacket[] = {0x81, 0xCC, 0x00, 0x0C,
53                                                     0x00, 0x00, 0x11, 0x11};
54 
55 // PT = 202, Source count = 0
56 static const uint8_t kNonCompoundRtcpSDESPacket[] = {0x80, 0xCA, 0x00, 0x00};
57 
58 static uint8_t kFakeTag[4] = {0xba, 0xdd, 0xba, 0xdd};
59 static uint8_t kTestKey[] = "12345678901234567890";
60 static uint8_t kTestAstValue[3] = {0xaa, 0xbb, 0xcc};
61 
62 // Valid rtp Message with 2 byte header extension.
63 static uint8_t kRtpMsgWith2ByteExtnHeader[] = {
64     // clang-format off
65     // clang formatting doesn't respect inline comments.
66   0x90, 0x00, 0x00, 0x00,
67   0x00, 0x00, 0x00, 0x00,
68   0xAA, 0xBB, 0xCC, 0XDD,  // SSRC
69   0x10, 0x00, 0x00, 0x01,  // 2 Byte header extension
70   0x01, 0x00, 0x00, 0x00
71     // clang-format on
72 };
73 
74 // RTP packet with two one-byte header extensions. The last 4 bytes consist of
75 // abs-send-time with extension id = 3 and length = 3.
76 static uint8_t kRtpMsgWithOneByteAbsSendTimeExtension[] = {
77     0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78     0xBE, 0xDE, 0x00, 0x02, 0x22, 0x00, 0x02, 0x1c, 0x32, 0xaa, 0xbb, 0xcc,
79 };
80 
81 // RTP packet with two two-byte header extensions. The last 5 bytes consist of
82 // abs-send-time with extension id = 3 and length = 3.
83 static uint8_t kRtpMsgWithTwoByteAbsSendTimeExtension[] = {
84     0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85     0x10, 0x00, 0x00, 0x02, 0x02, 0x01, 0x02, 0x03, 0x03, 0xaa, 0xbb, 0xcc,
86 };
87 
88 // Index of AbsSendTimeExtn data in message
89 // |kRtpMsgWithOneByteAbsSendTimeExtension|.
90 static const int kAstIndexInOneByteRtpMsg = 21;
91 // and in message |kRtpMsgWithTwoByteAbsSendTimeExtension|.
92 static const int kAstIndexInTwoByteRtpMsg = 21;
93 
94 static const rtc::ArrayView<const char> kPcmuFrameArrayView =
95     rtc::MakeArrayView(reinterpret_cast<const char*>(kPcmuFrame),
96                        sizeof(kPcmuFrame));
97 static const rtc::ArrayView<const char> kRtcpReportArrayView =
98     rtc::MakeArrayView(reinterpret_cast<const char*>(kRtcpReport),
99                        sizeof(kRtcpReport));
100 static const rtc::ArrayView<const char> kInvalidPacketArrayView =
101     rtc::MakeArrayView(reinterpret_cast<const char*>(kInvalidPacket),
102                        sizeof(kInvalidPacket));
103 
TEST(RtpUtilsTest,GetRtp)104 TEST(RtpUtilsTest, GetRtp) {
105   EXPECT_TRUE(IsRtpPacket(kPcmuFrameArrayView));
106 
107   int pt;
108   EXPECT_TRUE(GetRtpPayloadType(kPcmuFrame, sizeof(kPcmuFrame), &pt));
109   EXPECT_EQ(0, pt);
110   EXPECT_TRUE(GetRtpPayloadType(kRtpPacketWithMarker,
111                                 sizeof(kRtpPacketWithMarker), &pt));
112   EXPECT_EQ(0, pt);
113 
114   int seq_num;
115   EXPECT_TRUE(GetRtpSeqNum(kPcmuFrame, sizeof(kPcmuFrame), &seq_num));
116   EXPECT_EQ(1, seq_num);
117 
118   uint32_t ts;
119   EXPECT_TRUE(GetRtpTimestamp(kPcmuFrame, sizeof(kPcmuFrame), &ts));
120   EXPECT_EQ(0u, ts);
121 
122   uint32_t ssrc;
123   EXPECT_TRUE(GetRtpSsrc(kPcmuFrame, sizeof(kPcmuFrame), &ssrc));
124   EXPECT_EQ(1u, ssrc);
125 
126   RtpHeader header;
127   EXPECT_TRUE(GetRtpHeader(kPcmuFrame, sizeof(kPcmuFrame), &header));
128   EXPECT_EQ(0, header.payload_type);
129   EXPECT_EQ(1, header.seq_num);
130   EXPECT_EQ(0u, header.timestamp);
131   EXPECT_EQ(1u, header.ssrc);
132 
133   EXPECT_FALSE(GetRtpPayloadType(kInvalidPacket, sizeof(kInvalidPacket), &pt));
134   EXPECT_FALSE(GetRtpSeqNum(kInvalidPacket, sizeof(kInvalidPacket), &seq_num));
135   EXPECT_FALSE(GetRtpTimestamp(kInvalidPacket, sizeof(kInvalidPacket), &ts));
136   EXPECT_FALSE(GetRtpSsrc(kInvalidPacket, sizeof(kInvalidPacket), &ssrc));
137 }
138 
TEST(RtpUtilsTest,SetRtpHeader)139 TEST(RtpUtilsTest, SetRtpHeader) {
140   uint8_t packet[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
142 
143   RtpHeader header = {9, 1111, 2222u, 3333u};
144   EXPECT_TRUE(SetRtpHeader(packet, sizeof(packet), header));
145 
146   // Bits: 10 0 0 0000
147   EXPECT_EQ(128u, packet[0]);
148   size_t len;
149   EXPECT_TRUE(GetRtpHeaderLen(packet, sizeof(packet), &len));
150   EXPECT_EQ(12U, len);
151   EXPECT_TRUE(GetRtpHeader(packet, sizeof(packet), &header));
152   EXPECT_EQ(9, header.payload_type);
153   EXPECT_EQ(1111, header.seq_num);
154   EXPECT_EQ(2222u, header.timestamp);
155   EXPECT_EQ(3333u, header.ssrc);
156 }
157 
TEST(RtpUtilsTest,GetRtpHeaderLen)158 TEST(RtpUtilsTest, GetRtpHeaderLen) {
159   size_t len;
160   EXPECT_TRUE(GetRtpHeaderLen(kPcmuFrame, sizeof(kPcmuFrame), &len));
161   EXPECT_EQ(12U, len);
162 
163   EXPECT_TRUE(GetRtpHeaderLen(kRtpPacketWithMarkerAndCsrcAndExtension,
164                               sizeof(kRtpPacketWithMarkerAndCsrcAndExtension),
165                               &len));
166   EXPECT_EQ(sizeof(kRtpPacketWithMarkerAndCsrcAndExtension), len);
167 
168   EXPECT_FALSE(GetRtpHeaderLen(kInvalidPacket, sizeof(kInvalidPacket), &len));
169   EXPECT_FALSE(GetRtpHeaderLen(kInvalidPacketWithCsrc,
170                                sizeof(kInvalidPacketWithCsrc), &len));
171   EXPECT_FALSE(GetRtpHeaderLen(kInvalidPacketWithCsrcAndExtension1,
172                                sizeof(kInvalidPacketWithCsrcAndExtension1),
173                                &len));
174   EXPECT_FALSE(GetRtpHeaderLen(kInvalidPacketWithCsrcAndExtension2,
175                                sizeof(kInvalidPacketWithCsrcAndExtension2),
176                                &len));
177 }
178 
TEST(RtpUtilsTest,GetRtcp)179 TEST(RtpUtilsTest, GetRtcp) {
180   int pt;
181   EXPECT_TRUE(GetRtcpType(kRtcpReport, sizeof(kRtcpReport), &pt));
182   EXPECT_EQ(0xc9, pt);
183 
184   EXPECT_FALSE(GetRtcpType(kInvalidPacket, sizeof(kInvalidPacket), &pt));
185 
186   uint32_t ssrc;
187   EXPECT_TRUE(GetRtcpSsrc(kNonCompoundRtcpPliFeedbackPacket,
188                           sizeof(kNonCompoundRtcpPliFeedbackPacket), &ssrc));
189   EXPECT_TRUE(GetRtcpSsrc(kNonCompoundRtcpAppPacket,
190                           sizeof(kNonCompoundRtcpAppPacket), &ssrc));
191   EXPECT_FALSE(GetRtcpSsrc(kNonCompoundRtcpSDESPacket,
192                            sizeof(kNonCompoundRtcpSDESPacket), &ssrc));
193 }
194 
195 // Invalid RTP packets.
TEST(RtpUtilsTest,InvalidRtpHeader)196 TEST(RtpUtilsTest, InvalidRtpHeader) {
197   // Rtp message with invalid length.
198   const uint8_t kRtpMsgWithInvalidLength[] = {
199       // clang-format off
200       // clang formatting doesn't respect inline comments.
201       0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202       0xAA, 0xBB, 0xCC, 0XDD,  // SSRC
203       0xDD, 0xCC, 0xBB, 0xAA,  // Only 1 CSRC, but CC count is 4.
204       // clang-format on
205   };
206   EXPECT_FALSE(ValidateRtpHeader(kRtpMsgWithInvalidLength,
207                                  sizeof(kRtpMsgWithInvalidLength), nullptr));
208 
209   // Rtp message with single byte header extension, invalid extension length.
210   const uint8_t kRtpMsgWithInvalidExtnLength[] = {
211       0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212       0x00, 0x00, 0x00, 0x00, 0xBE, 0xDE, 0x0A, 0x00,  // Extn length - 0x0A00
213   };
214   EXPECT_FALSE(ValidateRtpHeader(kRtpMsgWithInvalidExtnLength,
215                                  sizeof(kRtpMsgWithInvalidExtnLength),
216                                  nullptr));
217 }
218 
219 // Valid RTP packet with a 2byte header extension.
TEST(RtpUtilsTest,Valid2ByteExtnHdrRtpMessage)220 TEST(RtpUtilsTest, Valid2ByteExtnHdrRtpMessage) {
221   EXPECT_TRUE(ValidateRtpHeader(kRtpMsgWith2ByteExtnHeader,
222                                 sizeof(kRtpMsgWith2ByteExtnHeader), nullptr));
223 }
224 
225 // Valid RTP packet which has 1 byte header AbsSendTime extension in it.
TEST(RtpUtilsTest,ValidRtpPacketWithOneByteAbsSendTimeExtension)226 TEST(RtpUtilsTest, ValidRtpPacketWithOneByteAbsSendTimeExtension) {
227   EXPECT_TRUE(ValidateRtpHeader(kRtpMsgWithOneByteAbsSendTimeExtension,
228                                 sizeof(kRtpMsgWithOneByteAbsSendTimeExtension),
229                                 nullptr));
230 }
231 
232 // Valid RTP packet which has 2 byte header AbsSendTime extension in it.
TEST(RtpUtilsTest,ValidRtpPacketWithTwoByteAbsSendTimeExtension)233 TEST(RtpUtilsTest, ValidRtpPacketWithTwoByteAbsSendTimeExtension) {
234   EXPECT_TRUE(ValidateRtpHeader(kRtpMsgWithTwoByteAbsSendTimeExtension,
235                                 sizeof(kRtpMsgWithTwoByteAbsSendTimeExtension),
236                                 nullptr));
237 }
238 
239 // Verify finding an extension ID in the TURN send indication message.
TEST(RtpUtilsTest,UpdateAbsSendTimeExtensionInTurnSendIndication)240 TEST(RtpUtilsTest, UpdateAbsSendTimeExtensionInTurnSendIndication) {
241   // A valid STUN indication message with a valid RTP header in data attribute
242   // payload field and no extension bit set.
243   uint8_t message_without_extension[] = {
244       // clang-format off
245       // clang formatting doesn't respect inline comments.
246       0x00, 0x16, 0x00, 0x18,  // length of
247       0x21, 0x12, 0xA4, 0x42,  // magic cookie
248       '0',  '1',  '2',  '3',   // transaction id
249       '4',  '5',  '6',  '7',
250       '8',  '9',  'a',  'b',
251       0x00, 0x20, 0x00, 0x04,  // Mapped address.
252       0x00, 0x00, 0x00, 0x00,
253       0x00, 0x13, 0x00, 0x0C,  // Data attribute.
254       0x80, 0x00, 0x00, 0x00,  // RTP packet.
255       0x00, 0x00, 0x00, 0x00,
256       0x00, 0x00, 0x00, 0x00,
257       // clang-format on
258   };
259   EXPECT_TRUE(UpdateRtpAbsSendTimeExtension(
260       message_without_extension, sizeof(message_without_extension), 3, 0));
261 
262   // A valid STUN indication message with a valid RTP header and a extension
263   // header.
264   uint8_t message[] = {
265       // clang-format off
266       // clang formatting doesn't respect inline comments.
267       0x00, 0x16, 0x00, 0x24,  // length of
268       0x21, 0x12, 0xA4, 0x42,  // magic cookie
269       '0',  '1',  '2',  '3',   // transaction id
270       '4',  '5',  '6',  '7',
271       '8',  '9',  'a',  'b',
272       0x00, 0x20, 0x00, 0x04,  // Mapped address.
273       0x00, 0x00, 0x00, 0x00,
274       0x00, 0x13, 0x00, 0x18,  // Data attribute.
275       0x90, 0x00, 0x00, 0x00,  // RTP packet.
276       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xDE,
277       0x00, 0x02, 0x22, 0xaa, 0xbb, 0xcc, 0x32, 0xaa, 0xbb, 0xcc,
278       // clang-format on
279   };
280   EXPECT_TRUE(UpdateRtpAbsSendTimeExtension(message, sizeof(message), 3, 0));
281 }
282 
283 // Test without any packet options variables set. This method should return
284 // without HMAC value in the packet.
TEST(RtpUtilsTest,ApplyPacketOptionsWithDefaultValues)285 TEST(RtpUtilsTest, ApplyPacketOptionsWithDefaultValues) {
286   rtc::PacketTimeUpdateParams packet_time_params;
287   std::vector<uint8_t> rtp_packet(
288       kRtpMsgWithOneByteAbsSendTimeExtension,
289       kRtpMsgWithOneByteAbsSendTimeExtension +
290           sizeof(kRtpMsgWithOneByteAbsSendTimeExtension));
291   rtp_packet.insert(rtp_packet.end(), kFakeTag, kFakeTag + sizeof(kFakeTag));
292   EXPECT_TRUE(ApplyPacketOptions(&rtp_packet[0], rtp_packet.size(),
293                                  packet_time_params, 0));
294 
295   // Making sure HMAC wasn't updated..
296   EXPECT_EQ(0,
297             memcmp(&rtp_packet[sizeof(kRtpMsgWithOneByteAbsSendTimeExtension)],
298                    kFakeTag, 4));
299 
300   // Verify AbsouluteSendTime extension field wasn't modified.
301   EXPECT_EQ(0, memcmp(&rtp_packet[kAstIndexInOneByteRtpMsg], kTestAstValue,
302                       sizeof(kTestAstValue)));
303 }
304 
305 // Veirfy HMAC is updated when packet option parameters are set.
TEST(RtpUtilsTest,ApplyPacketOptionsWithAuthParams)306 TEST(RtpUtilsTest, ApplyPacketOptionsWithAuthParams) {
307   rtc::PacketTimeUpdateParams packet_time_params;
308   packet_time_params.srtp_auth_key.assign(kTestKey,
309                                           kTestKey + sizeof(kTestKey));
310   packet_time_params.srtp_auth_tag_len = 4;
311 
312   std::vector<uint8_t> rtp_packet(
313       kRtpMsgWithOneByteAbsSendTimeExtension,
314       kRtpMsgWithOneByteAbsSendTimeExtension +
315           sizeof(kRtpMsgWithOneByteAbsSendTimeExtension));
316   rtp_packet.insert(rtp_packet.end(), kFakeTag, kFakeTag + sizeof(kFakeTag));
317   EXPECT_TRUE(ApplyPacketOptions(&rtp_packet[0], rtp_packet.size(),
318                                  packet_time_params, 0));
319 
320   uint8_t kExpectedTag[] = {0xc1, 0x7a, 0x8c, 0xa0};
321   EXPECT_EQ(0,
322             memcmp(&rtp_packet[sizeof(kRtpMsgWithOneByteAbsSendTimeExtension)],
323                    kExpectedTag, sizeof(kExpectedTag)));
324 
325   // Verify AbsouluteSendTime extension field is not modified.
326   EXPECT_EQ(0, memcmp(&rtp_packet[kAstIndexInOneByteRtpMsg], kTestAstValue,
327                       sizeof(kTestAstValue)));
328 }
329 
330 // Verify finding an extension ID in a raw rtp message.
TEST(RtpUtilsTest,UpdateOneByteAbsSendTimeExtensionInRtpPacket)331 TEST(RtpUtilsTest, UpdateOneByteAbsSendTimeExtensionInRtpPacket) {
332   std::vector<uint8_t> rtp_packet(
333       kRtpMsgWithOneByteAbsSendTimeExtension,
334       kRtpMsgWithOneByteAbsSendTimeExtension +
335           sizeof(kRtpMsgWithOneByteAbsSendTimeExtension));
336 
337   EXPECT_TRUE(UpdateRtpAbsSendTimeExtension(&rtp_packet[0], rtp_packet.size(),
338                                             3, 51183266));
339 
340   // Verify that the timestamp was updated.
341   const uint8_t kExpectedTimestamp[3] = {0xcc, 0xbb, 0xaa};
342   EXPECT_EQ(0, memcmp(&rtp_packet[kAstIndexInOneByteRtpMsg], kExpectedTimestamp,
343                       sizeof(kExpectedTimestamp)));
344 }
345 
346 // Verify finding an extension ID in a raw rtp message.
TEST(RtpUtilsTest,UpdateTwoByteAbsSendTimeExtensionInRtpPacket)347 TEST(RtpUtilsTest, UpdateTwoByteAbsSendTimeExtensionInRtpPacket) {
348   std::vector<uint8_t> rtp_packet(
349       kRtpMsgWithTwoByteAbsSendTimeExtension,
350       kRtpMsgWithTwoByteAbsSendTimeExtension +
351           sizeof(kRtpMsgWithTwoByteAbsSendTimeExtension));
352 
353   EXPECT_TRUE(UpdateRtpAbsSendTimeExtension(&rtp_packet[0], rtp_packet.size(),
354                                             3, 51183266));
355 
356   // Verify that the timestamp was updated.
357   const uint8_t kExpectedTimestamp[3] = {0xcc, 0xbb, 0xaa};
358   EXPECT_EQ(0, memcmp(&rtp_packet[kAstIndexInTwoByteRtpMsg], kExpectedTimestamp,
359                       sizeof(kExpectedTimestamp)));
360 }
361 
362 // Verify we update both AbsSendTime extension header and HMAC.
TEST(RtpUtilsTest,ApplyPacketOptionsWithAuthParamsAndAbsSendTime)363 TEST(RtpUtilsTest, ApplyPacketOptionsWithAuthParamsAndAbsSendTime) {
364   rtc::PacketTimeUpdateParams packet_time_params;
365   packet_time_params.srtp_auth_key.assign(kTestKey,
366                                           kTestKey + sizeof(kTestKey));
367   packet_time_params.srtp_auth_tag_len = 4;
368   packet_time_params.rtp_sendtime_extension_id = 3;
369   // 3 is also present in the test message.
370 
371   std::vector<uint8_t> rtp_packet(
372       kRtpMsgWithOneByteAbsSendTimeExtension,
373       kRtpMsgWithOneByteAbsSendTimeExtension +
374           sizeof(kRtpMsgWithOneByteAbsSendTimeExtension));
375   rtp_packet.insert(rtp_packet.end(), kFakeTag, kFakeTag + sizeof(kFakeTag));
376   EXPECT_TRUE(ApplyPacketOptions(&rtp_packet[0], rtp_packet.size(),
377                                  packet_time_params, 51183266));
378 
379   const uint8_t kExpectedTag[] = {0x81, 0xd1, 0x2c, 0x0e};
380   EXPECT_EQ(0,
381             memcmp(&rtp_packet[sizeof(kRtpMsgWithOneByteAbsSendTimeExtension)],
382                    kExpectedTag, sizeof(kExpectedTag)));
383 
384   // Verify that the timestamp was updated.
385   const uint8_t kExpectedTimestamp[3] = {0xcc, 0xbb, 0xaa};
386   EXPECT_EQ(0, memcmp(&rtp_packet[kAstIndexInOneByteRtpMsg], kExpectedTimestamp,
387                       sizeof(kExpectedTimestamp)));
388 }
389 
TEST(RtpUtilsTest,InferRtpPacketType)390 TEST(RtpUtilsTest, InferRtpPacketType) {
391   EXPECT_EQ(RtpPacketType::kRtp, InferRtpPacketType(kPcmuFrameArrayView));
392   EXPECT_EQ(RtpPacketType::kRtcp, InferRtpPacketType(kRtcpReportArrayView));
393   EXPECT_EQ(RtpPacketType::kUnknown,
394             InferRtpPacketType(kInvalidPacketArrayView));
395 }
396 
397 }  // namespace cricket
398