OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 } | 102 } |
103 | 103 |
104 TEST(H264ProfileLevelId, TestToStringInvalid) { | 104 TEST(H264ProfileLevelId, TestToStringInvalid) { |
105 EXPECT_FALSE(ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b))); | 105 EXPECT_FALSE(ProfileLevelIdToString(ProfileLevelId(kProfileHigh, kLevel1_b))); |
106 EXPECT_FALSE(ProfileLevelIdToString( | 106 EXPECT_FALSE(ProfileLevelIdToString( |
107 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b))); | 107 ProfileLevelId(kProfileConstrainedHigh, kLevel1_b))); |
108 EXPECT_FALSE(ProfileLevelIdToString( | 108 EXPECT_FALSE(ProfileLevelIdToString( |
109 ProfileLevelId(static_cast<Profile>(255), kLevel3_1))); | 109 ProfileLevelId(static_cast<Profile>(255), kLevel3_1))); |
110 } | 110 } |
111 | 111 |
112 TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdEmpty) { | |
113 const rtc::Optional<ProfileLevelId> profile_level_id = | |
114 ParseSdpProfileLevelId(CodecParameterMap()); | |
115 EXPECT_TRUE(profile_level_id); | |
116 EXPECT_EQ(kProfileConstrainedBaseline, profile_level_id->profile); | |
117 EXPECT_EQ(kLevel3_1, profile_level_id->level); | |
118 } | |
119 | |
120 TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdConstrainedHigh) { | |
121 CodecParameterMap params; | |
122 params["profile-level-id"] = "640c2a"; | |
123 const rtc::Optional<ProfileLevelId> profile_level_id = | |
124 ParseSdpProfileLevelId(params); | |
125 EXPECT_TRUE(profile_level_id); | |
126 EXPECT_EQ(kProfileConstrainedHigh, profile_level_id->profile); | |
127 EXPECT_EQ(kLevel4_2, profile_level_id->level); | |
128 } | |
129 | |
130 TEST(H264ProfileLevelId, TestParseSdpProfileLevelIdInvalid) { | |
131 CodecParameterMap params; | |
132 params["profile-level-id"] = "foobar"; | |
133 EXPECT_FALSE(ParseSdpProfileLevelId(params)); | |
134 } | |
135 | |
136 TEST(H264ProfileLevelId, TestNegotiateProfileLevelIdEmpty) { | |
137 const rtc::Optional<ProfileLevelId> profile_level_id = | |
138 NegotiateProfileLevelId(CodecParameterMap(), CodecParameterMap()); | |
139 EXPECT_TRUE(profile_level_id); | |
140 EXPECT_EQ(kProfileConstrainedBaseline, profile_level_id->profile); | |
141 EXPECT_EQ(kLevel3_1, profile_level_id->level); | |
142 } | |
143 | |
144 TEST(H264ProfileLevelId, TestNegotiateProfileLevelIdInvalid) { | |
145 CodecParameterMap local_params; | |
146 local_params["profile-level-id"] = "foobar"; | |
147 EXPECT_FALSE(NegotiateProfileLevelId(local_params, CodecParameterMap())); | |
148 } | |
149 | |
150 TEST(H264ProfileLevelId, TestNegotiateProfileLevelIdDifferentProfiles) { | |
151 CodecParameterMap local_params; | |
152 local_params["profile-level-id"] = "42e01f"; | |
153 CodecParameterMap remote_params; | |
154 remote_params["profile-level-id"] = "640c2a"; | |
155 EXPECT_FALSE(NegotiateProfileLevelId(local_params, remote_params)); | |
hta-webrtc
2016/11/08 09:39:06
Given that profiles form subsets too, I'm not sure
magjed_webrtc
2016/11/08 15:48:40
This test does not make sense anymore since the pr
| |
156 } | |
157 | |
158 TEST(H264ProfileLevelId, TestNegotiateProfileLevelIdLevelSymmetryRejected) { | |
159 CodecParameterMap local_params; | |
160 local_params["profile-level-id"] = "42e015"; | |
161 CodecParameterMap remote_params; | |
162 remote_params["profile-level-id"] = "42e01f"; | |
163 // The codec should be rejected since local can't handle the remote level. | |
164 EXPECT_FALSE(NegotiateProfileLevelId(local_params, remote_params)); | |
hta-webrtc
2016/11/08 09:39:06
This test is wrong.
magjed_webrtc
2016/11/08 15:48:40
Yes, it's removed now.
| |
165 } | |
166 | |
167 TEST(H264ProfileLevelId, TestNegotiateProfileLevelIdLevelSymmetryCapped) { | |
168 CodecParameterMap local_params; | |
169 local_params["profile-level-id"] = "42e01f"; | |
170 CodecParameterMap remote_params; | |
171 remote_params["profile-level-id"] = "42e015"; | |
172 const rtc::Optional<ProfileLevelId> profile_level_id = | |
173 NegotiateProfileLevelId(local_params, remote_params); | |
174 EXPECT_TRUE(profile_level_id); | |
175 EXPECT_EQ(kProfileConstrainedBaseline, profile_level_id->profile); | |
176 // The level should be capped by the remote capabilities. | |
177 EXPECT_EQ(kLevel2_1, profile_level_id->level); | |
hta-webrtc
2016/11/08 09:39:06
It's not very readable to set the parameters in te
magjed_webrtc
2016/11/08 15:48:40
Done, strings are used everywhere now.
| |
178 } | |
179 | |
180 TEST(H264ProfileLevelId, | |
181 TestNegotiateProfileLevelIdConstrainedBaselineLevelAsymmetry) { | |
182 CodecParameterMap local_params; | |
183 local_params["profile-level-id"] = "42e01f"; | |
184 local_params["level-asymmetry-allowed"] = "1"; | |
185 CodecParameterMap remote_params; | |
186 remote_params["profile-level-id"] = "42e015"; | |
187 remote_params["level-asymmetry-allowed"] = "1"; | |
188 const rtc::Optional<ProfileLevelId> profile_level_id = | |
189 NegotiateProfileLevelId(local_params, remote_params); | |
190 EXPECT_TRUE(profile_level_id); | |
191 EXPECT_EQ(kProfileConstrainedBaseline, profile_level_id->profile); | |
192 // We should be able to send a level different from the remote capabilities. | |
193 EXPECT_EQ(kLevel3_1, profile_level_id->level); | |
hta-webrtc
2016/11/08 09:39:06
Actually, we should send with the remote capabilit
magjed_webrtc
2016/11/08 15:48:40
Yeah, the 'send level' in the comment is actually
| |
194 } | |
195 | |
112 } // namespace H264 | 196 } // namespace H264 |
113 } // namespace webrtc | 197 } // namespace webrtc |
OLD | NEW |