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 |
11 #include "webrtc/base/gunit.h" | 11 #include "webrtc/base/gunit.h" |
12 #include "webrtc/common_types.h" | |
12 #include "webrtc/media/base/codec.h" | 13 #include "webrtc/media/base/codec.h" |
13 | 14 |
14 using cricket::AudioCodec; | 15 using cricket::AudioCodec; |
15 using cricket::Codec; | 16 using cricket::Codec; |
16 using cricket::DataCodec; | 17 using cricket::DataCodec; |
17 using cricket::FeedbackParam; | 18 using cricket::FeedbackParam; |
18 using cricket::VideoCodec; | 19 using cricket::VideoCodec; |
19 using cricket::kCodecParamAssociatedPayloadType; | 20 using cricket::kCodecParamAssociatedPayloadType; |
20 using cricket::kCodecParamMaxBitrate; | 21 using cricket::kCodecParamMaxBitrate; |
21 using cricket::kCodecParamMinBitrate; | 22 using cricket::kCodecParamMinBitrate; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 EXPECT_EQ(cricket::kVideoCodecClockrate, codec_params_1.clock_rate); | 311 EXPECT_EQ(cricket::kVideoCodecClockrate, codec_params_1.clock_rate); |
311 EXPECT_EQ(1, codec_params_1.channels); | 312 EXPECT_EQ(1, codec_params_1.channels); |
312 | 313 |
313 const AudioCodec a(97, "A", 44100, 20000, 2); | 314 const AudioCodec a(97, "A", 44100, 20000, 2); |
314 webrtc::RtpCodecParameters codec_params_2 = a.ToCodecParameters(); | 315 webrtc::RtpCodecParameters codec_params_2 = a.ToCodecParameters(); |
315 EXPECT_EQ(97, codec_params_2.payload_type); | 316 EXPECT_EQ(97, codec_params_2.payload_type); |
316 EXPECT_EQ("A", codec_params_2.mime_type); | 317 EXPECT_EQ("A", codec_params_2.mime_type); |
317 EXPECT_EQ(44100, codec_params_2.clock_rate); | 318 EXPECT_EQ(44100, codec_params_2.clock_rate); |
318 EXPECT_EQ(2, codec_params_2.channels); | 319 EXPECT_EQ(2, codec_params_2.channels); |
319 } | 320 } |
321 | |
322 TEST(H264ProfileLevelIdParsing, TestInvalid) { | |
323 // Malformed strings. | |
tommi
2016/10/28 10:09:47
test too long strings too?
magjed_webrtc
2016/10/28 14:59:27
Done, I added a test with 8 hex characters. I also
| |
324 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("")); | |
325 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId(" 42e01f")); | |
326 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("e01f")); | |
327 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("gggggg")); | |
328 | |
329 // Invalid level. | |
330 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("42e000")); | |
331 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("42e00f")); | |
332 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("42e0ff")); | |
333 | |
334 // Invalid profile. | |
335 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("42e11f")); | |
336 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("58601f")); | |
337 EXPECT_FALSE(webrtc::ParseH264ProfileLevelId("64e01f")); | |
338 } | |
339 | |
340 TEST(H264ProfileLevelIdParsing, TestLevel) { | |
341 EXPECT_EQ(webrtc::kH264Level3_1, | |
342 webrtc::ParseH264ProfileLevelId("42e01f")->level); | |
343 EXPECT_EQ(webrtc::kH264Level1_1, | |
344 webrtc::ParseH264ProfileLevelId("42e00b")->level); | |
345 EXPECT_EQ(webrtc::kH264Level1_b, | |
346 webrtc::ParseH264ProfileLevelId("42f00b")->level); | |
347 EXPECT_EQ(webrtc::kH264Level4_2, | |
348 webrtc::ParseH264ProfileLevelId("42C02A")->level); | |
349 EXPECT_EQ(webrtc::kH264Level5_2, | |
350 webrtc::ParseH264ProfileLevelId("640c34")->level); | |
351 } | |
352 | |
353 TEST(H264ProfileLevelIdParsing, TestConstrainedBaseline) { | |
354 EXPECT_EQ(webrtc::kProfileConstrainedBaseline, | |
355 webrtc::ParseH264ProfileLevelId("42e01f")->profile); | |
356 EXPECT_EQ(webrtc::kProfileConstrainedBaseline, | |
357 webrtc::ParseH264ProfileLevelId("42C02A")->profile); | |
358 EXPECT_EQ(webrtc::kProfileConstrainedBaseline, | |
359 webrtc::ParseH264ProfileLevelId("4de01f")->profile); | |
360 EXPECT_EQ(webrtc::kProfileConstrainedBaseline, | |
361 webrtc::ParseH264ProfileLevelId("58f01f")->profile); | |
362 } | |
363 | |
364 TEST(H264ProfileLevelIdParsing, TestBaseline) { | |
365 EXPECT_EQ(webrtc::kProfileBaseline, | |
366 webrtc::ParseH264ProfileLevelId("42a01f")->profile); | |
367 EXPECT_EQ(webrtc::kProfileBaseline, | |
368 webrtc::ParseH264ProfileLevelId("58A01F")->profile); | |
369 } | |
370 | |
371 TEST(H264ProfileLevelIdParsing, TestMain) { | |
372 EXPECT_EQ(webrtc::kProfileMain, | |
373 webrtc::ParseH264ProfileLevelId("4D401f")->profile); | |
374 } | |
375 | |
376 TEST(H264ProfileLevelIdParsing, TestHigh) { | |
377 EXPECT_EQ(webrtc::kProfileHigh, | |
378 webrtc::ParseH264ProfileLevelId("64001f")->profile); | |
379 } | |
380 | |
381 TEST(H264ProfileLevelIdParsing, TestConstrainedHigh) { | |
382 EXPECT_EQ(webrtc::kProfileConstrainedHigh, | |
383 webrtc::ParseH264ProfileLevelId("640c1f")->profile); | |
384 } | |
OLD | NEW |