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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); | 528 &codec_, static_cast<const int*>(kTestTemporalLayerProfile)); |
529 codec_.numberOfSimulcastStreams = 3; | 529 codec_.numberOfSimulcastStreams = 3; |
530 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); | 530 EXPECT_EQ(0, adapter_->InitEncode(&codec_, 1, 1200)); |
531 adapter_->RegisterEncodeCompleteCallback(this); | 531 adapter_->RegisterEncodeCompleteCallback(this); |
532 ASSERT_EQ(3u, helper_->factory()->encoders().size()); | 532 ASSERT_EQ(3u, helper_->factory()->encoders().size()); |
533 // Tell the 2nd encoder to request software fallback. | 533 // Tell the 2nd encoder to request software fallback. |
534 EXPECT_CALL(*helper_->factory()->encoders()[1], Encode(_, _, _)) | 534 EXPECT_CALL(*helper_->factory()->encoders()[1], Encode(_, _, _)) |
535 .WillOnce(Return(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE)); | 535 .WillOnce(Return(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE)); |
536 | 536 |
537 // Send a fake frame and assert the return is software fallback. | 537 // Send a fake frame and assert the return is software fallback. |
538 VideoFrame input_frame; | |
539 int half_width = (kDefaultWidth + 1) / 2; | 538 int half_width = (kDefaultWidth + 1) / 2; |
540 input_frame.CreateEmptyFrame(kDefaultWidth, kDefaultHeight, kDefaultWidth, | 539 rtc::scoped_refptr<I420Buffer> input_buffer = I420Buffer::Create( |
541 half_width, half_width); | 540 kDefaultWidth, kDefaultHeight, kDefaultWidth, half_width, half_width); |
542 memset(input_frame.video_frame_buffer()->MutableDataY(), 0, | 541 input_buffer->InitializeData(); |
543 input_frame.allocated_size(kYPlane)); | 542 VideoFrame input_frame(input_buffer, 0, 0, webrtc::kVideoRotation_0); |
544 memset(input_frame.video_frame_buffer()->MutableDataU(), 0, | |
545 input_frame.allocated_size(kUPlane)); | |
546 memset(input_frame.video_frame_buffer()->MutableDataV(), 0, | |
547 input_frame.allocated_size(kVPlane)); | |
548 | |
549 std::vector<FrameType> frame_types(3, kVideoFrameKey); | 543 std::vector<FrameType> frame_types(3, kVideoFrameKey); |
550 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, | 544 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, |
551 adapter_->Encode(input_frame, nullptr, &frame_types)); | 545 adapter_->Encode(input_frame, nullptr, &frame_types)); |
552 } | 546 } |
553 | 547 |
554 } // namespace testing | 548 } // namespace testing |
555 } // namespace webrtc | 549 } // namespace webrtc |
OLD | NEW |