OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2009 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 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 EXPECT_TRUE(c5 == c6); | 61 EXPECT_TRUE(c5 == c6); |
62 } | 62 } |
63 | 63 |
64 TEST(CodecTest, TestAudioCodecOperators) { | 64 TEST(CodecTest, TestAudioCodecOperators) { |
65 AudioCodec c0(96, "A", 44100, 20000, 2); | 65 AudioCodec c0(96, "A", 44100, 20000, 2); |
66 AudioCodec c1(95, "A", 44100, 20000, 2); | 66 AudioCodec c1(95, "A", 44100, 20000, 2); |
67 AudioCodec c2(96, "x", 44100, 20000, 2); | 67 AudioCodec c2(96, "x", 44100, 20000, 2); |
68 AudioCodec c3(96, "A", 48000, 20000, 2); | 68 AudioCodec c3(96, "A", 48000, 20000, 2); |
69 AudioCodec c4(96, "A", 44100, 10000, 2); | 69 AudioCodec c4(96, "A", 44100, 10000, 2); |
70 AudioCodec c5(96, "A", 44100, 20000, 1); | 70 AudioCodec c5(96, "A", 44100, 20000, 1); |
71 EXPECT_TRUE(c0 != c1); | 71 EXPECT_NE(c0, c1); |
72 EXPECT_TRUE(c0 != c2); | 72 EXPECT_NE(c0, c2); |
73 EXPECT_TRUE(c0 != c3); | 73 EXPECT_NE(c0, c3); |
74 EXPECT_TRUE(c0 != c4); | 74 EXPECT_NE(c0, c4); |
75 EXPECT_TRUE(c0 != c5); | 75 EXPECT_NE(c0, c5); |
76 | 76 |
77 AudioCodec c7; | 77 AudioCodec c7; |
78 AudioCodec c8(0, "", 0, 0, 0); | 78 AudioCodec c8(0, "", 0, 0, 0); |
79 AudioCodec c9 = c0; | 79 AudioCodec c9 = c0; |
80 EXPECT_TRUE(c8 == c7); | 80 EXPECT_EQ(c8, c7); |
81 EXPECT_TRUE(c9 != c7); | 81 EXPECT_NE(c9, c7); |
82 EXPECT_TRUE(c9 == c0); | 82 EXPECT_EQ(c9, c0); |
83 | 83 |
84 AudioCodec c10(c0); | 84 AudioCodec c10(c0); |
85 AudioCodec c11(c0); | 85 AudioCodec c11(c0); |
86 AudioCodec c12(c0); | 86 AudioCodec c12(c0); |
87 AudioCodec c13(c0); | 87 AudioCodec c13(c0); |
88 c10.params["x"] = "abc"; | 88 c10.params["x"] = "abc"; |
89 c11.params["x"] = "def"; | 89 c11.params["x"] = "def"; |
90 c12.params["y"] = "abc"; | 90 c12.params["y"] = "abc"; |
91 c13.params["x"] = "abc"; | 91 c13.params["x"] = "abc"; |
92 EXPECT_TRUE(c10 != c0); | 92 EXPECT_NE(c10, c0); |
93 EXPECT_TRUE(c11 != c0); | 93 EXPECT_NE(c11, c0); |
94 EXPECT_TRUE(c11 != c10); | 94 EXPECT_NE(c11, c10); |
95 EXPECT_TRUE(c12 != c0); | 95 EXPECT_NE(c12, c0); |
96 EXPECT_TRUE(c12 != c10); | 96 EXPECT_NE(c12, c10); |
97 EXPECT_TRUE(c12 != c11); | 97 EXPECT_NE(c12, c11); |
98 EXPECT_TRUE(c13 == c10); | 98 EXPECT_EQ(c13, c10); |
99 } | 99 } |
100 | 100 |
101 TEST(CodecTest, TestAudioCodecMatches) { | 101 TEST(CodecTest, TestAudioCodecMatches) { |
102 // Test a codec with a static payload type. | 102 // Test a codec with a static payload type. |
103 AudioCodec c0(95, "A", 44100, 20000, 1); | 103 AudioCodec c0(95, "A", 44100, 20000, 1); |
104 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 44100, 20000, 1))); | 104 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 44100, 20000, 1))); |
105 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 44100, 20000, 0))); | 105 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 44100, 20000, 0))); |
106 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 44100, 0, 0))); | 106 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 44100, 0, 0))); |
107 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 0, 0, 0))); | 107 EXPECT_TRUE(c0.Matches(AudioCodec(95, "", 0, 0, 0))); |
108 EXPECT_FALSE(c0.Matches(AudioCodec(96, "", 44100, 20000, 1))); | 108 EXPECT_FALSE(c0.Matches(AudioCodec(96, "", 44100, 20000, 1))); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 EXPECT_EQ(rtc::Optional<int>(), codec_params_1.num_channels); | 318 EXPECT_EQ(rtc::Optional<int>(), codec_params_1.num_channels); |
319 | 319 |
320 const AudioCodec a(97, "A", 44100, 20000, 2); | 320 const AudioCodec a(97, "A", 44100, 20000, 2); |
321 webrtc::RtpCodecParameters codec_params_2 = a.ToCodecParameters(); | 321 webrtc::RtpCodecParameters codec_params_2 = a.ToCodecParameters(); |
322 EXPECT_EQ(97, codec_params_2.payload_type); | 322 EXPECT_EQ(97, codec_params_2.payload_type); |
323 EXPECT_EQ(cricket::MEDIA_TYPE_AUDIO, codec_params_2.kind); | 323 EXPECT_EQ(cricket::MEDIA_TYPE_AUDIO, codec_params_2.kind); |
324 EXPECT_EQ("A", codec_params_2.name); | 324 EXPECT_EQ("A", codec_params_2.name); |
325 EXPECT_EQ(rtc::Optional<int>(44100), codec_params_2.clock_rate); | 325 EXPECT_EQ(rtc::Optional<int>(44100), codec_params_2.clock_rate); |
326 EXPECT_EQ(rtc::Optional<int>(2), codec_params_2.num_channels); | 326 EXPECT_EQ(rtc::Optional<int>(2), codec_params_2.num_channels); |
327 } | 327 } |
OLD | NEW |