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

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

Issue 1426813002: Update layer indices for non-flexible mode according to updates in the RTP payload profile. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove unused ss_map 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // 105 //
106 // Payload descriptor for non-flexible mode 106 // Payload descriptor for non-flexible mode
107 // 0 1 2 3 4 5 6 7 107 // 0 1 2 3 4 5 6 7
108 // +-+-+-+-+-+-+-+-+ 108 // +-+-+-+-+-+-+-+-+
109 // |I|P|L|F|B|E|V|-| (REQUIRED) 109 // |I|P|L|F|B|E|V|-| (REQUIRED)
110 // +-+-+-+-+-+-+-+-+ 110 // +-+-+-+-+-+-+-+-+
111 // I: |M| PICTURE ID | (RECOMMENDED) 111 // I: |M| PICTURE ID | (RECOMMENDED)
112 // +-+-+-+-+-+-+-+-+ 112 // +-+-+-+-+-+-+-+-+
113 // M: | EXTENDED PID | (RECOMMENDED) 113 // M: | EXTENDED PID | (RECOMMENDED)
114 // +-+-+-+-+-+-+-+-+ 114 // +-+-+-+-+-+-+-+-+
115 // L: |GOF_IDX| S |D| (CONDITIONALLY RECOMMENDED) 115 // L: | T |U| S |D| (CONDITIONALLY RECOMMENDED)
116 // +-+-+-+-+-+-+-+-+ 116 // +-+-+-+-+-+-+-+-+
117 // | TL0PICIDX | (CONDITIONALLY REQUIRED) 117 // | TL0PICIDX | (CONDITIONALLY REQUIRED)
118 // +-+-+-+-+-+-+-+-+ 118 // +-+-+-+-+-+-+-+-+
119 // V: | SS | 119 // V: | SS |
120 // | .. | 120 // | .. |
121 // +-+-+-+-+-+-+-+-+ 121 // +-+-+-+-+-+-+-+-+
122 122
123 class RtpPacketizerVp9Test : public ::testing::Test { 123 class RtpPacketizerVp9Test : public ::testing::Test {
124 protected: 124 protected:
125 RtpPacketizerVp9Test() {} 125 RtpPacketizerVp9Test() {}
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 const size_t kExpectedHdrSizes[] = {3, 3, 3, 3}; 248 const size_t kExpectedHdrSizes[] = {3, 3, 3, 3};
249 const size_t kExpectedSizes[] = {11, 11, 11, 10}; 249 const size_t kExpectedSizes[] = {11, 11, 11, 10};
250 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); 250 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes);
251 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum); 251 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum);
252 } 252 }
253 253
254 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithNonFlexibleMode) { 254 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithNonFlexibleMode) {
255 const size_t kFrameSize = 30; 255 const size_t kFrameSize = 30;
256 const size_t kPacketSize = 25; 256 const size_t kPacketSize = 25;
257 257
258 expected_.gof_idx = 3; 258 expected_.temporal_idx = 3;
259 expected_.temporal_up_switch = true; // U
259 expected_.num_spatial_layers = 3; 260 expected_.num_spatial_layers = 3;
260 expected_.spatial_idx = 2; 261 expected_.spatial_idx = 2;
261 expected_.inter_layer_predicted = true; // D 262 expected_.inter_layer_predicted = true; // D
262 expected_.tl0_pic_idx = 117; 263 expected_.tl0_pic_idx = 117;
263 Init(kFrameSize, kPacketSize); 264 Init(kFrameSize, kPacketSize);
264 265
265 // Two packets: 266 // Two packets:
266 // | I:0, P:0, L:1, F:0, B:1, E:0, V:0 | (3hdr + 15 payload) 267 // | I:0, P:0, L:1, F:0, B:1, E:0, V:0 | (3hdr + 15 payload)
267 // L: | GOF_IDX:3, S:2, D:1 | TL0PICIDX:117 | 268 // L: | T:3, U:1, S:2, D:1 | TL0PICIDX:117 |
268 // | I:0, P:0, L:1, F:0, B:0, E:1, V:0 | (3hdr + 15 payload) 269 // | I:0, P:0, L:1, F:0, B:0, E:1, V:0 | (3hdr + 15 payload)
269 // L: | GOF_IDX:3, S:2, D:1 | TL0PICIDX:117 | 270 // L: | T:3, U:1, S:2, D:1 | TL0PICIDX:117 |
270 const size_t kExpectedHdrSizes[] = {3, 3}; 271 const size_t kExpectedHdrSizes[] = {3, 3};
271 const size_t kExpectedSizes[] = {18, 18}; 272 const size_t kExpectedSizes[] = {18, 18};
272 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); 273 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes);
273 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum); 274 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum);
274 } 275 }
275 276
276 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithFlexibleMode) { 277 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithFlexibleMode) {
277 const size_t kFrameSize = 21; 278 const size_t kFrameSize = 21;
278 const size_t kPacketSize = 23; 279 const size_t kPacketSize = 23;
279 280
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 packet[1] = 0x80 | ((kMaxTwoBytePictureId >> 8) & 0x7F); 499 packet[1] = 0x80 | ((kMaxTwoBytePictureId >> 8) & 0x7F);
499 packet[2] = kMaxTwoBytePictureId & 0xFF; 500 packet[2] = kMaxTwoBytePictureId & 0xFF;
500 501
501 expected_.picture_id = kMaxTwoBytePictureId; 502 expected_.picture_id = kMaxTwoBytePictureId;
502 expected_.max_picture_id = kMaxTwoBytePictureId; 503 expected_.max_picture_id = kMaxTwoBytePictureId;
503 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet)); 504 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet));
504 } 505 }
505 506
506 TEST_F(RtpDepacketizerVp9Test, ParseLayerInfoWithNonFlexibleMode) { 507 TEST_F(RtpDepacketizerVp9Test, ParseLayerInfoWithNonFlexibleMode) {
507 const uint8_t kHeaderLength = 3; 508 const uint8_t kHeaderLength = 3;
508 const uint8_t kGofIdx = 7; 509 const uint8_t kTemporalIdx = 2;
510 const uint8_t kUbit = 1;
509 const uint8_t kSpatialIdx = 1; 511 const uint8_t kSpatialIdx = 1;
510 const uint8_t kDbit = 1; 512 const uint8_t kDbit = 1;
511 const uint8_t kTl0PicIdx = 17; 513 const uint8_t kTl0PicIdx = 17;
512 uint8_t packet[13] = {0}; 514 uint8_t packet[13] = {0};
513 packet[0] = 0x20; // I:0 P:0 L:1 F:0 B:0 E:0 V:0 R:0 515 packet[0] = 0x20; // I:0 P:0 L:1 F:0 B:0 E:0 V:0 R:0
514 packet[1] = (kGofIdx << 4) | (kSpatialIdx << 1) | kDbit; // GOF_IDX:7 S:1 D:1 516 packet[1] = (kTemporalIdx << 5) | (kUbit << 4) | (kSpatialIdx << 1) | kDbit;
515 packet[2] = kTl0PicIdx; // TL0PICIDX:17 517 packet[2] = kTl0PicIdx;
516 518
517 expected_.gof_idx = kGofIdx; 519 // T:2 U:1 S:1 D:1
520 // TL0PICIDX:17
521 expected_.temporal_idx = kTemporalIdx;
522 expected_.temporal_up_switch = kUbit ? true : false;
518 expected_.spatial_idx = kSpatialIdx; 523 expected_.spatial_idx = kSpatialIdx;
519 expected_.inter_layer_predicted = kDbit ? true : false; 524 expected_.inter_layer_predicted = kDbit ? true : false;
520 expected_.tl0_pic_idx = kTl0PicIdx; 525 expected_.tl0_pic_idx = kTl0PicIdx;
521 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet)); 526 ParseAndCheckPacket(packet, expected_, kHeaderLength, sizeof(packet));
522 } 527 }
523 528
524 TEST_F(RtpDepacketizerVp9Test, ParseLayerInfoWithFlexibleMode) { 529 TEST_F(RtpDepacketizerVp9Test, ParseLayerInfoWithFlexibleMode) {
525 const uint8_t kHeaderLength = 2; 530 const uint8_t kHeaderLength = 2;
526 const uint8_t kTemporalIdx = 2; 531 const uint8_t kTemporalIdx = 2;
527 const uint8_t kUbit = 1; 532 const uint8_t kUbit = 1;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 681 }
677 682
678 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) { 683 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) {
679 const uint8_t kHeaderLength = 1; 684 const uint8_t kHeaderLength = 1;
680 uint8_t packet[kHeaderLength] = {0}; 685 uint8_t packet[kHeaderLength] = {0};
681 RtpDepacketizer::ParsedPayload parsed; 686 RtpDepacketizer::ParsedPayload parsed;
682 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); 687 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet)));
683 } 688 }
684 689
685 } // 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.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698