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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_vp9_unittest.cc

Issue 1409753007: Reland of "Change type of pid_diff (int16_t -> uint8_t) according to updates in RTP payload profile… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: also update include/module_common_types.h Created 5 years, 1 month 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
OLDNEW
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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 EXPECT_EQ(expected.width[i], actual.width[i]); 48 EXPECT_EQ(expected.width[i], actual.width[i]);
49 EXPECT_EQ(expected.height[i], actual.height[i]); 49 EXPECT_EQ(expected.height[i], actual.height[i]);
50 } 50 }
51 } 51 }
52 EXPECT_EQ(expected.gof.num_frames_in_gof, actual.gof.num_frames_in_gof); 52 EXPECT_EQ(expected.gof.num_frames_in_gof, actual.gof.num_frames_in_gof);
53 for (size_t i = 0; i < expected.gof.num_frames_in_gof; i++) { 53 for (size_t i = 0; i < expected.gof.num_frames_in_gof; i++) {
54 EXPECT_EQ(expected.gof.temporal_up_switch[i], 54 EXPECT_EQ(expected.gof.temporal_up_switch[i],
55 actual.gof.temporal_up_switch[i]); 55 actual.gof.temporal_up_switch[i]);
56 EXPECT_EQ(expected.gof.temporal_idx[i], actual.gof.temporal_idx[i]); 56 EXPECT_EQ(expected.gof.temporal_idx[i], actual.gof.temporal_idx[i]);
57 EXPECT_EQ(expected.gof.num_ref_pics[i], actual.gof.num_ref_pics[i]); 57 EXPECT_EQ(expected.gof.num_ref_pics[i], actual.gof.num_ref_pics[i]);
58 for (size_t j = 0; j < expected.gof.num_ref_pics[i]; j++) { 58 for (uint8_t j = 0; j < expected.gof.num_ref_pics[i]; j++) {
59 EXPECT_EQ(expected.gof.pid_diff[i][j], actual.gof.pid_diff[i][j]); 59 EXPECT_EQ(expected.gof.pid_diff[i][j], actual.gof.pid_diff[i][j]);
60 } 60 }
61 } 61 }
62 } 62 }
63 } 63 }
64 64
65 void VerifyPayload(const RtpDepacketizer::ParsedPayload& parsed, 65 void VerifyPayload(const RtpDepacketizer::ParsedPayload& parsed,
66 const uint8_t* payload, 66 const uint8_t* payload,
67 size_t payload_length) { 67 size_t payload_length) {
68 EXPECT_EQ(payload, parsed.payload); 68 EXPECT_EQ(payload, parsed.payload);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 expected_.temporal_idx = kTemporalIdx; 543 expected_.temporal_idx = kTemporalIdx;
544 expected_.temporal_up_switch = kUbit ? true : false; 544 expected_.temporal_up_switch = kUbit ? true : false;
545 expected_.spatial_idx = kSpatialIdx; 545 expected_.spatial_idx = kSpatialIdx;
546 expected_.inter_layer_predicted = kDbit ? true : false; 546 expected_.inter_layer_predicted = kDbit ? true : false;
547 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet)); 547 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet));
548 } 548 }
549 549
550 TEST_F(RtpDepacketizerVp9Test, ParseRefIdx) { 550 TEST_F(RtpDepacketizerVp9Test, ParseRefIdx) {
551 const uint8_t kHeaderLength = 6; 551 const uint8_t kHeaderLength = 6;
552 const int16_t kPictureId = 17; 552 const int16_t kPictureId = 17;
553 const int16_t kPdiff1 = 17; 553 const uint8_t kPdiff1 = 17;
554 const int16_t kPdiff2 = 18; 554 const uint8_t kPdiff2 = 18;
555 const int16_t kPdiff3 = 127; 555 const uint8_t kPdiff3 = 127;
556 uint8_t packet[13] = {0}; 556 uint8_t packet[13] = {0};
557 packet[0] = 0xD8; // I:1 P:1 L:0 F:1 B:1 E:0 V:0 R:0 557 packet[0] = 0xD8; // I:1 P:1 L:0 F:1 B:1 E:0 V:0 R:0
558 packet[1] = 0x80 | ((kPictureId >> 8) & 0x7F); // Two byte pictureID. 558 packet[1] = 0x80 | ((kPictureId >> 8) & 0x7F); // Two byte pictureID.
559 packet[2] = kPictureId; 559 packet[2] = kPictureId;
560 packet[3] = (kPdiff1 << 1) | 1; // P_DIFF N:1 560 packet[3] = (kPdiff1 << 1) | 1; // P_DIFF N:1
561 packet[4] = (kPdiff2 << 1) | 1; // P_DIFF N:1 561 packet[4] = (kPdiff2 << 1) | 1; // P_DIFF N:1
562 packet[5] = (kPdiff3 << 1) | 0; // P_DIFF N:0 562 packet[5] = (kPdiff3 << 1) | 0; // P_DIFF N:0
563 563
564 // I:1 P:1 L:0 F:1 B:1 E:0 V:0 564 // I:1 P:1 L:0 F:1 B:1 E:0 V:0
565 // I: PICTURE ID:17 565 // I: PICTURE ID:17
566 // I: 566 // I:
567 // P,F: P_DIFF:17 N:1 => refPicId = 17 - 17 = 0 567 // P,F: P_DIFF:17 N:1 => refPicId = 17 - 17 = 0
568 // P,F: P_DIFF:18 N:1 => refPicId = (kMaxPictureId + 1) + 17 - 18 = 0x7FFF 568 // P,F: P_DIFF:18 N:1 => refPicId = (kMaxPictureId + 1) + 17 - 18 = 0x7FFF
569 // P,F: P_DIFF:127 N:0 => refPicId = (kMaxPictureId + 1) + 17 - 127 = 32658 569 // P,F: P_DIFF:127 N:0 => refPicId = (kMaxPictureId + 1) + 17 - 127 = 32658
570 expected_.beginning_of_frame = true; 570 expected_.beginning_of_frame = true;
571 expected_.inter_pic_predicted = true; 571 expected_.inter_pic_predicted = true;
572 expected_.flexible_mode = true; 572 expected_.flexible_mode = true;
573 expected_.picture_id = kPictureId; 573 expected_.picture_id = kPictureId;
574 expected_.num_ref_pics = 3; 574 expected_.num_ref_pics = 3;
575 expected_.pid_diff[0] = kPdiff1; 575 expected_.pid_diff[0] = kPdiff1;
576 expected_.pid_diff[1] = kPdiff2; 576 expected_.pid_diff[1] = kPdiff2;
577 expected_.pid_diff[2] = kPdiff3; 577 expected_.pid_diff[2] = kPdiff3;
578 expected_.ref_picture_id[0] = 0; 578 expected_.ref_picture_id[0] = 0;
579 expected_.ref_picture_id[1] = 0x7FFF; 579 expected_.ref_picture_id[1] = 0x7FFF;
580 expected_.ref_picture_id[2] = 32658; 580 expected_.ref_picture_id[2] = 32658;
581 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet)); 581 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet));
582 } 582 }
583 583
584 TEST_F(RtpDepacketizerVp9Test, ParseRefIdxFailsWithNoPictureId) { 584 TEST_F(RtpDepacketizerVp9Test, ParseRefIdxFailsWithNoPictureId) {
585 const int16_t kPdiff = 3; 585 const uint8_t kPdiff = 3;
586 uint8_t packet[13] = {0}; 586 uint8_t packet[13] = {0};
587 packet[0] = 0x58; // I:0 P:1 L:0 F:1 B:1 E:0 V:0 R:0 587 packet[0] = 0x58; // I:0 P:1 L:0 F:1 B:1 E:0 V:0 R:0
588 packet[1] = (kPdiff << 1); // P,F: P_DIFF:3 N:0 588 packet[1] = (kPdiff << 1); // P,F: P_DIFF:3 N:0
589 589
590 RtpDepacketizer::ParsedPayload parsed; 590 RtpDepacketizer::ParsedPayload parsed;
591 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); 591 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet)));
592 } 592 }
593 593
594 TEST_F(RtpDepacketizerVp9Test, ParseRefIdxFailsWithTooManyRefPics) { 594 TEST_F(RtpDepacketizerVp9Test, ParseRefIdxFailsWithTooManyRefPics) {
595 const int16_t kPdiff = 3; 595 const uint8_t kPdiff = 3;
596 uint8_t packet[13] = {0}; 596 uint8_t packet[13] = {0};
597 packet[0] = 0xD8; // I:1 P:1 L:0 F:1 B:1 E:0 V:0 R:0 597 packet[0] = 0xD8; // I:1 P:1 L:0 F:1 B:1 E:0 V:0 R:0
598 packet[1] = kMaxOneBytePictureId; // I: PICTURE ID:127 598 packet[1] = kMaxOneBytePictureId; // I: PICTURE ID:127
599 packet[2] = (kPdiff << 1) | 1; // P,F: P_DIFF:3 N:1 599 packet[2] = (kPdiff << 1) | 1; // P,F: P_DIFF:3 N:1
600 packet[3] = (kPdiff << 1) | 1; // P,F: P_DIFF:3 N:1 600 packet[3] = (kPdiff << 1) | 1; // P,F: P_DIFF:3 N:1
601 packet[4] = (kPdiff << 1) | 1; // P,F: P_DIFF:3 N:1 601 packet[4] = (kPdiff << 1) | 1; // P,F: P_DIFF:3 N:1
602 packet[5] = (kPdiff << 1) | 0; // P,F: P_DIFF:3 N:0 602 packet[5] = (kPdiff << 1) | 0; // P,F: P_DIFF:3 N:0
603 603
604 RtpDepacketizer::ParsedPayload parsed; 604 RtpDepacketizer::ParsedPayload parsed;
605 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); 605 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet)));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 } 681 }
682 682
683 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) { 683 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) {
684 const uint8_t kHeaderLength = 1; 684 const uint8_t kHeaderLength = 1;
685 uint8_t packet[kHeaderLength] = {0}; 685 uint8_t packet[kHeaderLength] = {0};
686 RtpDepacketizer::ParsedPayload parsed; 686 RtpDepacketizer::ParsedPayload parsed;
687 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); 687 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet)));
688 } 688 }
689 689
690 } // namespace webrtc 690 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format_vp9.cc ('k') | webrtc/modules/video_coding/main/source/jitter_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698