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 |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
| 14 #include "webrtc/common_video/include/video_frame_buffer.h" |
14 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" | 15 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" |
15 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h" | 16 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h" |
16 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 17 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
17 #include "webrtc/test/gmock.h" | 18 #include "webrtc/test/gmock.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 namespace testing { | 21 namespace testing { |
21 | 22 |
22 class TestSimulcastEncoderAdapter : public TestVp8Simulcast { | 23 class TestSimulcastEncoderAdapter : public TestVp8Simulcast { |
23 public: | 24 public: |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 for (MockVideoEncoder* encoder : helper_->factory()->encoders()) | 496 for (MockVideoEncoder* encoder : helper_->factory()->encoders()) |
496 encoder->set_supports_native_handle(true); | 497 encoder->set_supports_native_handle(true); |
497 // If one encoder doesn't support it, then overall support is disabled. | 498 // If one encoder doesn't support it, then overall support is disabled. |
498 helper_->factory()->encoders()[0]->set_supports_native_handle(false); | 499 helper_->factory()->encoders()[0]->set_supports_native_handle(false); |
499 EXPECT_FALSE(adapter_->SupportsNativeHandle()); | 500 EXPECT_FALSE(adapter_->SupportsNativeHandle()); |
500 // Once all do, then the adapter claims support. | 501 // Once all do, then the adapter claims support. |
501 helper_->factory()->encoders()[0]->set_supports_native_handle(true); | 502 helper_->factory()->encoders()[0]->set_supports_native_handle(true); |
502 EXPECT_TRUE(adapter_->SupportsNativeHandle()); | 503 EXPECT_TRUE(adapter_->SupportsNativeHandle()); |
503 } | 504 } |
504 | 505 |
| 506 // TODO(nisse): Reuse definition in webrtc/test/fake_texture_handle.h. |
505 class FakeNativeHandleBuffer : public NativeHandleBuffer { | 507 class FakeNativeHandleBuffer : public NativeHandleBuffer { |
506 public: | 508 public: |
507 FakeNativeHandleBuffer(void* native_handle, int width, int height) | 509 FakeNativeHandleBuffer(void* native_handle, int width, int height) |
508 : NativeHandleBuffer(native_handle, width, height) {} | 510 : NativeHandleBuffer(native_handle, width, height) {} |
509 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override { | 511 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override { |
510 RTC_NOTREACHED(); | 512 RTC_NOTREACHED(); |
511 return nullptr; | 513 return nullptr; |
512 } | 514 } |
513 }; | 515 }; |
514 | 516 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 codec_.numberOfSimulcastStreams = 3; | 570 codec_.numberOfSimulcastStreams = 3; |
569 helper_->factory()->set_init_encode_return_value( | 571 helper_->factory()->set_init_encode_return_value( |
570 WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE); | 572 WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE); |
571 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, | 573 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, |
572 adapter_->InitEncode(&codec_, 1, 1200)); | 574 adapter_->InitEncode(&codec_, 1, 1200)); |
573 EXPECT_TRUE(helper_->factory()->encoders().empty()); | 575 EXPECT_TRUE(helper_->factory()->encoders().empty()); |
574 } | 576 } |
575 | 577 |
576 } // namespace testing | 578 } // namespace testing |
577 } // namespace webrtc | 579 } // namespace webrtc |
OLD | NEW |