| OLD | NEW |
| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 const size_t kExpectedSizes[] = {11, 11, 11, 10}; | 251 const size_t kExpectedSizes[] = {11, 11, 11, 10}; |
| 252 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); | 252 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); |
| 253 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum); | 253 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum); |
| 254 } | 254 } |
| 255 | 255 |
| 256 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithNonFlexibleMode) { | 256 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithNonFlexibleMode) { |
| 257 const size_t kFrameSize = 30; | 257 const size_t kFrameSize = 30; |
| 258 const size_t kPacketSize = 25; | 258 const size_t kPacketSize = 25; |
| 259 | 259 |
| 260 expected_.gof_idx = 3; | 260 expected_.gof_idx = 3; |
| 261 expected_.num_spatial_layers = 3; |
| 261 expected_.spatial_idx = 2; | 262 expected_.spatial_idx = 2; |
| 262 expected_.inter_layer_predicted = true; // D | 263 expected_.inter_layer_predicted = true; // D |
| 263 expected_.tl0_pic_idx = 117; | 264 expected_.tl0_pic_idx = 117; |
| 264 Init(kFrameSize, kPacketSize); | 265 Init(kFrameSize, kPacketSize); |
| 265 | 266 |
| 266 // Two packets: | 267 // Two packets: |
| 267 // | I:0, P:0, L:1, F:0, B:1, E:0, V:0 | (3hdr + 15 payload) | 268 // | I:0, P:0, L:1, F:0, B:1, E:0, V:0 | (3hdr + 15 payload) |
| 268 // L: | GOF_IDX:3, S:2, D:1 | TL0PICIDX:117 | | 269 // L: | GOF_IDX:3, S:2, D:1 | TL0PICIDX:117 | |
| 269 // | I:0, P:0, L:1, F:0, B:0, E:1, V:0 | (3hdr + 15 payload) | 270 // | I:0, P:0, L:1, F:0, B:0, E:1, V:0 | (3hdr + 15 payload) |
| 270 // L: | GOF_IDX:3, S:2, D:1 | TL0PICIDX:117 | | 271 // L: | GOF_IDX:3, S:2, D:1 | TL0PICIDX:117 | |
| 271 const size_t kExpectedHdrSizes[] = {3, 3}; | 272 const size_t kExpectedHdrSizes[] = {3, 3}; |
| 272 const size_t kExpectedSizes[] = {18, 18}; | 273 const size_t kExpectedSizes[] = {18, 18}; |
| 273 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); | 274 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); |
| 274 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum); | 275 CreateParseAndCheckPackets(kExpectedHdrSizes, kExpectedSizes, kExpectedNum); |
| 275 } | 276 } |
| 276 | 277 |
| 277 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithFlexibleMode) { | 278 TEST_F(RtpPacketizerVp9Test, TestLayerInfoWithFlexibleMode) { |
| 278 const size_t kFrameSize = 21; | 279 const size_t kFrameSize = 21; |
| 279 const size_t kPacketSize = 23; | 280 const size_t kPacketSize = 23; |
| 280 | 281 |
| 281 expected_.flexible_mode = true; | 282 expected_.flexible_mode = true; |
| 282 expected_.temporal_idx = 3; | 283 expected_.temporal_idx = 3; |
| 283 expected_.temporal_up_switch = true; // U | 284 expected_.temporal_up_switch = true; // U |
| 285 expected_.num_spatial_layers = 3; |
| 284 expected_.spatial_idx = 2; | 286 expected_.spatial_idx = 2; |
| 285 expected_.inter_layer_predicted = false; // D | 287 expected_.inter_layer_predicted = false; // D |
| 286 Init(kFrameSize, kPacketSize); | 288 Init(kFrameSize, kPacketSize); |
| 287 | 289 |
| 288 // One packet: | 290 // One packet: |
| 289 // I:0, P:0, L:1, F:1, B:1, E:1, V:0 (2hdr + 21 payload) | 291 // I:0, P:0, L:1, F:1, B:1, E:1, V:0 (2hdr + 21 payload) |
| 290 // L: T:3, U:1, S:2, D:0 | 292 // L: T:3, U:1, S:2, D:0 |
| 291 const size_t kExpectedHdrSizes[] = {2}; | 293 const size_t kExpectedHdrSizes[] = {2}; |
| 292 const size_t kExpectedSizes[] = {23}; | 294 const size_t kExpectedSizes[] = {23}; |
| 293 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); | 295 const size_t kExpectedNum = GTEST_ARRAY_SIZE_(kExpectedSizes); |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 } | 653 } |
| 652 | 654 |
| 653 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) { | 655 TEST_F(RtpDepacketizerVp9Test, ParseFailsForTooShortBufferToFitPayload) { |
| 654 const uint8_t kHeaderLength = 1; | 656 const uint8_t kHeaderLength = 1; |
| 655 uint8_t packet[kHeaderLength] = {0}; | 657 uint8_t packet[kHeaderLength] = {0}; |
| 656 RtpDepacketizer::ParsedPayload parsed; | 658 RtpDepacketizer::ParsedPayload parsed; |
| 657 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); | 659 EXPECT_FALSE(depacketizer_->Parse(&parsed, packet, sizeof(packet))); |
| 658 } | 660 } |
| 659 | 661 |
| 660 } // namespace webrtc | 662 } // namespace webrtc |
| OLD | NEW |