OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); | 504 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); |
505 codec_.numberOfSimulcastStreams = 3; | 505 codec_.numberOfSimulcastStreams = 3; |
506 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); | 506 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); |
507 adapter_->RegisterEncodeCompleteCallback(this); | 507 adapter_->RegisterEncodeCompleteCallback(this); |
508 ASSERT_EQ(3u, helper_->factory()->encoders().size()); | 508 ASSERT_EQ(3u, helper_->factory()->encoders().size()); |
509 // Tell the 2nd encoder to request software fallback. | 509 // Tell the 2nd encoder to request software fallback. |
510 EXPECT_CALL(*helper_->factory()->encoders()[1], Encode(_, _, _)) | 510 EXPECT_CALL(*helper_->factory()->encoders()[1], Encode(_, _, _)) |
511 .WillOnce(Return(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE)); | 511 .WillOnce(Return(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE)); |
512 | 512 |
513 // Send a fake frame and assert the return is software fallback. | 513 // Send a fake frame and assert the return is software fallback. |
514 VideoFrame input_frame; | |
515 int half_width = (kDefaultWidth + 1) / 2; | 514 int half_width = (kDefaultWidth + 1) / 2; |
516 input_frame.CreateEmptyFrame(kDefaultWidth, kDefaultHeight, kDefaultWidth, | 515 rtc::scoped_refptr<I420Buffer> input_buffer = I420Buffer::Create( |
517 half_width, half_width); | 516 kDefaultWidth, kDefaultHeight, kDefaultWidth, half_width, half_width); |
518 memset(input_frame.video_frame_buffer()->MutableDataY(), 0, | 517 input_buffer->InitializeData(); |
519 input_frame.allocated_size(kYPlane)); | 518 VideoFrame input_frame(input_buffer, 0, 0, webrtc::kVideoRotation_0); |
520 memset(input_frame.video_frame_buffer()->MutableDataU(), 0, | |
521 input_frame.allocated_size(kUPlane)); | |
522 memset(input_frame.video_frame_buffer()->MutableDataV(), 0, | |
523 input_frame.allocated_size(kVPlane)); | |
524 | |
525 std::vector<FrameType> frame_types(3, kVideoFrameKey); | 519 std::vector<FrameType> frame_types(3, kVideoFrameKey); |
526 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, | 520 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, |
527 adapter_->Encode(input_frame, nullptr, &frame_types)); | 521 adapter_->Encode(input_frame, nullptr, &frame_types)); |
528 } | 522 } |
529 | 523 |
530 } // namespace testing | 524 } // namespace testing |
531 } // namespace webrtc | 525 } // namespace webrtc |
OLD | NEW |