Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: webrtc/video/packet_injection_tests.cc

Issue 1227923005: Split webrtc/video into webrtc/{audio,call,video}. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/rampup_tests.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2015 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 "testing/gtest/include/gtest/gtest.h"
12
13 #include "webrtc/test/call_test.h"
14 #include "webrtc/test/null_transport.h"
15
16 namespace webrtc {
17
18 class PacketInjectionTest : public test::CallTest {
19 protected:
20 enum class CodecType {
21 kVp8,
22 kH264,
23 };
24
25 PacketInjectionTest() : rtp_header_parser_(RtpHeaderParser::Create()) {}
26
27 void InjectIncorrectPacket(CodecType codec_type,
28 uint8_t packet_type,
29 const uint8_t* packet,
30 size_t length);
31
32 rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
33 };
34
35 void PacketInjectionTest::InjectIncorrectPacket(CodecType codec_type,
36 uint8_t payload_type,
37 const uint8_t* packet,
38 size_t length) {
39 CreateSenderCall(Call::Config());
40 CreateReceiverCall(Call::Config());
41
42 test::NullTransport null_transport;
43 CreateSendConfig(1, &null_transport);
44 CreateMatchingReceiveConfigs(&null_transport);
45 receive_configs_[0].decoders[0].payload_type = payload_type;
46 switch (codec_type) {
47 case CodecType::kVp8:
48 receive_configs_[0].decoders[0].payload_name = "VP8";
49 break;
50 case CodecType::kH264:
51 receive_configs_[0].decoders[0].payload_name = "H264";
52 break;
53 }
54 CreateStreams();
55
56 RTPHeader header;
57 EXPECT_TRUE(rtp_header_parser_->Parse(packet, length, &header));
58 EXPECT_EQ(kSendSsrcs[0], header.ssrc)
59 << "Packet should have configured SSRC to not be dropped early.";
60 EXPECT_EQ(payload_type, header.payloadType);
61 Start();
62 EXPECT_EQ(PacketReceiver::DELIVERY_PACKET_ERROR,
63 receiver_call_->Receiver()->DeliverPacket(MediaType::VIDEO, packet,
64 length, PacketTime()));
65 Stop();
66
67 DestroyStreams();
68 }
69
70 TEST_F(PacketInjectionTest, StapAPacketWithTruncatedNalUnits) {
71 const uint8_t kPacket[] = {0x80,
72 0xE5,
73 0xE6,
74 0x0,
75 0x0,
76 0xED,
77 0x23,
78 0x4,
79 0x00,
80 0xC0,
81 0xFF,
82 0xED,
83 0x58,
84 0xCB,
85 0xED,
86 0xDF};
87
88 InjectIncorrectPacket(CodecType::kH264, 101, kPacket, sizeof(kPacket));
89 }
90
91 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/rampup_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698