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> | 11 #include <memory> |
12 | 12 |
| 13 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
13 #include "webrtc/test/call_test.h" | 14 #include "webrtc/test/call_test.h" |
14 #include "webrtc/test/gtest.h" | 15 #include "webrtc/test/gtest.h" |
15 #include "webrtc/test/null_transport.h" | 16 #include "webrtc/test/null_transport.h" |
16 | 17 |
17 namespace webrtc { | 18 namespace webrtc { |
18 | 19 |
19 class PacketInjectionTest : public test::CallTest { | 20 class PacketInjectionTest : public test::CallTest { |
20 protected: | 21 protected: |
21 enum class CodecType { | 22 enum class CodecType { |
22 kVp8, | 23 kVp8, |
23 kH264, | 24 kH264, |
24 }; | 25 }; |
25 | 26 |
26 PacketInjectionTest() : rtp_header_parser_(RtpHeaderParser::Create()) {} | 27 PacketInjectionTest() : rtp_header_parser_(RtpHeaderParser::Create()) {} |
27 | 28 |
28 void InjectIncorrectPacket(CodecType codec_type, | 29 void InjectIncorrectPacket(CodecType codec_type, |
29 uint8_t packet_type, | 30 uint8_t packet_type, |
30 const uint8_t* packet, | 31 const uint8_t* packet, |
31 size_t length); | 32 size_t length); |
32 | 33 |
33 std::unique_ptr<RtpHeaderParser> rtp_header_parser_; | 34 std::unique_ptr<RtpHeaderParser> rtp_header_parser_; |
34 }; | 35 }; |
35 | 36 |
36 void PacketInjectionTest::InjectIncorrectPacket(CodecType codec_type, | 37 void PacketInjectionTest::InjectIncorrectPacket(CodecType codec_type, |
37 uint8_t payload_type, | 38 uint8_t payload_type, |
38 const uint8_t* packet, | 39 const uint8_t* packet, |
39 size_t length) { | 40 size_t length) { |
40 CreateSenderCall(Call::Config()); | 41 CreateSenderCall(Call::Config(&event_log_)); |
41 CreateReceiverCall(Call::Config()); | 42 CreateReceiverCall(Call::Config(&event_log_)); |
42 | 43 |
43 test::NullTransport null_transport; | 44 test::NullTransport null_transport; |
44 CreateSendConfig(1, 0, &null_transport); | 45 CreateSendConfig(1, 0, &null_transport); |
45 CreateMatchingReceiveConfigs(&null_transport); | 46 CreateMatchingReceiveConfigs(&null_transport); |
46 video_receive_configs_[0].decoders[0].payload_type = payload_type; | 47 video_receive_configs_[0].decoders[0].payload_type = payload_type; |
47 switch (codec_type) { | 48 switch (codec_type) { |
48 case CodecType::kVp8: | 49 case CodecType::kVp8: |
49 video_receive_configs_[0].decoders[0].payload_name = "VP8"; | 50 video_receive_configs_[0].decoders[0].payload_name = "VP8"; |
50 break; | 51 break; |
51 case CodecType::kH264: | 52 case CodecType::kH264: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 0xED, | 84 0xED, |
84 0x58, | 85 0x58, |
85 0xCB, | 86 0xCB, |
86 0xED, | 87 0xED, |
87 0xDF}; | 88 0xDF}; |
88 | 89 |
89 InjectIncorrectPacket(CodecType::kH264, 101, kPacket, sizeof(kPacket)); | 90 InjectIncorrectPacket(CodecType::kH264, 101, kPacket, sizeof(kPacket)); |
90 } | 91 } |
91 | 92 |
92 } // namespace webrtc | 93 } // namespace webrtc |
OLD | NEW |