OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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> |
| 12 |
11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
12 | 14 |
13 #include "webrtc/test/call_test.h" | 15 #include "webrtc/test/call_test.h" |
14 #include "webrtc/test/null_transport.h" | 16 #include "webrtc/test/null_transport.h" |
15 | 17 |
16 namespace webrtc { | 18 namespace webrtc { |
17 | 19 |
18 class PacketInjectionTest : public test::CallTest { | 20 class PacketInjectionTest : public test::CallTest { |
19 protected: | 21 protected: |
20 enum class CodecType { | 22 enum class CodecType { |
21 kVp8, | 23 kVp8, |
22 kH264, | 24 kH264, |
23 }; | 25 }; |
24 | 26 |
25 PacketInjectionTest() : rtp_header_parser_(RtpHeaderParser::Create()) {} | 27 PacketInjectionTest() : rtp_header_parser_(RtpHeaderParser::Create()) {} |
26 | 28 |
27 void InjectIncorrectPacket(CodecType codec_type, | 29 void InjectIncorrectPacket(CodecType codec_type, |
28 uint8_t packet_type, | 30 uint8_t packet_type, |
29 const uint8_t* packet, | 31 const uint8_t* packet, |
30 size_t length); | 32 size_t length); |
31 | 33 |
32 rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_; | 34 std::unique_ptr<RtpHeaderParser> rtp_header_parser_; |
33 }; | 35 }; |
34 | 36 |
35 void PacketInjectionTest::InjectIncorrectPacket(CodecType codec_type, | 37 void PacketInjectionTest::InjectIncorrectPacket(CodecType codec_type, |
36 uint8_t payload_type, | 38 uint8_t payload_type, |
37 const uint8_t* packet, | 39 const uint8_t* packet, |
38 size_t length) { | 40 size_t length) { |
39 CreateSenderCall(Call::Config()); | 41 CreateSenderCall(Call::Config()); |
40 CreateReceiverCall(Call::Config()); | 42 CreateReceiverCall(Call::Config()); |
41 | 43 |
42 test::NullTransport null_transport; | 44 test::NullTransport null_transport; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 0xED, | 84 0xED, |
83 0x58, | 85 0x58, |
84 0xCB, | 86 0xCB, |
85 0xED, | 87 0xED, |
86 0xDF}; | 88 0xDF}; |
87 | 89 |
88 InjectIncorrectPacket(CodecType::kH264, 101, kPacket, sizeof(kPacket)); | 90 InjectIncorrectPacket(CodecType::kH264, 101, kPacket, sizeof(kPacket)); |
89 } | 91 } |
90 | 92 |
91 } // namespace webrtc | 93 } // namespace webrtc |
OLD | NEW |