OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "webrtc/base/bytebuffer.h" | 14 #include "webrtc/base/bytebuffer.h" |
14 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
15 #include "webrtc/base/thread.h" | 16 #include "webrtc/base/thread.h" |
16 #include "webrtc/media/base/rtpdump.h" | 17 #include "webrtc/media/base/rtpdump.h" |
17 #include "webrtc/media/base/rtputils.h" | 18 #include "webrtc/media/base/rtputils.h" |
18 #include "webrtc/media/base/testutils.h" | 19 #include "webrtc/media/base/testutils.h" |
19 | 20 |
20 namespace cricket { | 21 namespace cricket { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 EXPECT_TRUE(rtcp_packet.IsValidRtcpPacket()); | 55 EXPECT_TRUE(rtcp_packet.IsValidRtcpPacket()); |
55 EXPECT_TRUE(rtcp_packet.GetRtcpType(&rtcp_type)); | 56 EXPECT_TRUE(rtcp_packet.GetRtcpType(&rtcp_type)); |
56 EXPECT_EQ(0, rtcp_type); | 57 EXPECT_EQ(0, rtcp_type); |
57 } | 58 } |
58 | 59 |
59 // Test that we read only the RTP dump file. | 60 // Test that we read only the RTP dump file. |
60 TEST(RtpDumpTest, ReadRtpDumpFile) { | 61 TEST(RtpDumpTest, ReadRtpDumpFile) { |
61 RtpDumpPacket packet; | 62 RtpDumpPacket packet; |
62 rtc::MemoryStream stream; | 63 rtc::MemoryStream stream; |
63 RtpDumpWriter writer(&stream); | 64 RtpDumpWriter writer(&stream); |
64 rtc::scoped_ptr<RtpDumpReader> reader; | 65 std::unique_ptr<RtpDumpReader> reader; |
65 | 66 |
66 // Write a RTP packet to the stream, which is a valid RTP dump. Next, we will | 67 // Write a RTP packet to the stream, which is a valid RTP dump. Next, we will |
67 // change the first line to make the RTP dump valid or invalid. | 68 // change the first line to make the RTP dump valid or invalid. |
68 ASSERT_TRUE(RtpTestUtility::WriteTestPackets(1, false, kTestSsrc, &writer)); | 69 ASSERT_TRUE(RtpTestUtility::WriteTestPackets(1, false, kTestSsrc, &writer)); |
69 stream.Rewind(); | 70 stream.Rewind(); |
70 reader.reset(new RtpDumpReader(&stream)); | 71 reader.reset(new RtpDumpReader(&stream)); |
71 EXPECT_EQ(rtc::SR_SUCCESS, reader->ReadPacket(&packet)); | 72 EXPECT_EQ(rtc::SR_SUCCESS, reader->ReadPacket(&packet)); |
72 | 73 |
73 // The first line is correct. | 74 // The first line is correct. |
74 stream.Rewind(); | 75 stream.Rewind(); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 273 |
273 // The loop reader reads three packets from the input stream. | 274 // The loop reader reads three packets from the input stream. |
274 stream.Rewind(); | 275 stream.Rewind(); |
275 RtpDumpLoopReader loop_reader(&stream); | 276 RtpDumpLoopReader loop_reader(&stream); |
276 EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet)); | 277 EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet)); |
277 EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet)); | 278 EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet)); |
278 EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet)); | 279 EXPECT_EQ(rtc::SR_SUCCESS, loop_reader.ReadPacket(&packet)); |
279 } | 280 } |
280 | 281 |
281 } // namespace cricket | 282 } // namespace cricket |
OLD | NEW |