| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 for (MockVideoEncoder* encoder : helper_->factory()->encoders()) | 485 for (MockVideoEncoder* encoder : helper_->factory()->encoders()) |
| 485 encoder->set_supports_native_handle(true); | 486 encoder->set_supports_native_handle(true); |
| 486 // If one encoder doesn't support it, then overall support is disabled. | 487 // If one encoder doesn't support it, then overall support is disabled. |
| 487 helper_->factory()->encoders()[0]->set_supports_native_handle(false); | 488 helper_->factory()->encoders()[0]->set_supports_native_handle(false); |
| 488 EXPECT_FALSE(adapter_->SupportsNativeHandle()); | 489 EXPECT_FALSE(adapter_->SupportsNativeHandle()); |
| 489 // Once all do, then the adapter claims support. | 490 // Once all do, then the adapter claims support. |
| 490 helper_->factory()->encoders()[0]->set_supports_native_handle(true); | 491 helper_->factory()->encoders()[0]->set_supports_native_handle(true); |
| 491 EXPECT_TRUE(adapter_->SupportsNativeHandle()); | 492 EXPECT_TRUE(adapter_->SupportsNativeHandle()); |
| 492 } | 493 } |
| 493 | 494 |
| 495 // TODO(nisse): Reuse definition in webrtc/test/fake_texture_handle.h. |
| 494 class FakeNativeHandleBuffer : public NativeHandleBuffer { | 496 class FakeNativeHandleBuffer : public NativeHandleBuffer { |
| 495 public: | 497 public: |
| 496 FakeNativeHandleBuffer(void* native_handle, int width, int height) | 498 FakeNativeHandleBuffer(void* native_handle, int width, int height) |
| 497 : NativeHandleBuffer(native_handle, width, height) {} | 499 : NativeHandleBuffer(native_handle, width, height) {} |
| 498 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override { | 500 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override { |
| 499 RTC_NOTREACHED(); | 501 RTC_NOTREACHED(); |
| 500 return nullptr; | 502 return nullptr; |
| 501 } | 503 } |
| 502 }; | 504 }; |
| 503 | 505 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 kDefaultWidth, kDefaultHeight, kDefaultWidth, half_width, half_width); | 547 kDefaultWidth, kDefaultHeight, kDefaultWidth, half_width, half_width); |
| 546 input_buffer->InitializeData(); | 548 input_buffer->InitializeData(); |
| 547 VideoFrame input_frame(input_buffer, 0, 0, webrtc::kVideoRotation_0); | 549 VideoFrame input_frame(input_buffer, 0, 0, webrtc::kVideoRotation_0); |
| 548 std::vector<FrameType> frame_types(3, kVideoFrameKey); | 550 std::vector<FrameType> frame_types(3, kVideoFrameKey); |
| 549 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, | 551 EXPECT_EQ(WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE, |
| 550 adapter_->Encode(input_frame, nullptr, &frame_types)); | 552 adapter_->Encode(input_frame, nullptr, &frame_types)); |
| 551 } | 553 } |
| 552 | 554 |
| 553 } // namespace testing | 555 } // namespace testing |
| 554 } // namespace webrtc | 556 } // namespace webrtc |
| OLD | NEW |