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 |
11 #include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h" | 11 #include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h" |
12 | 12 |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
| 15 #include "webrtc/api/video/i420_buffer.h" |
15 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
16 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" | 17 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" |
17 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 18 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
18 #include "webrtc/modules/video_coding/include/video_error_codes.h" | 19 #include "webrtc/modules/video_coding/include/video_error_codes.h" |
19 #include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h" | 20 #include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h" |
20 #include "webrtc/test/gtest.h" | 21 #include "webrtc/test/gtest.h" |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
24 const int kWidth = 320; | 25 const int kWidth = 320; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 CountingFakeEncoder fake_encoder_; | 120 CountingFakeEncoder fake_encoder_; |
120 VideoEncoderSoftwareFallbackWrapper fallback_wrapper_; | 121 VideoEncoderSoftwareFallbackWrapper fallback_wrapper_; |
121 VideoCodec codec_ = {}; | 122 VideoCodec codec_ = {}; |
122 std::unique_ptr<VideoFrame> frame_; | 123 std::unique_ptr<VideoFrame> frame_; |
123 std::unique_ptr<SimulcastRateAllocator> rate_allocator_; | 124 std::unique_ptr<SimulcastRateAllocator> rate_allocator_; |
124 }; | 125 }; |
125 | 126 |
126 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { | 127 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { |
127 rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create( | 128 rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create( |
128 kWidth, kHeight, kWidth, (kWidth + 1) / 2, (kWidth + 1) / 2); | 129 kWidth, kHeight, kWidth, (kWidth + 1) / 2, (kWidth + 1) / 2); |
129 buffer->SetToBlack(); | 130 I420Buffer::SetBlack(buffer); |
130 std::vector<FrameType> types(1, kVideoFrameKey); | 131 std::vector<FrameType> types(1, kVideoFrameKey); |
131 | 132 |
132 frame_.reset(new VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); | 133 frame_.reset(new VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); |
133 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 134 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
134 fallback_wrapper_.Encode(*frame_, nullptr, &types)); | 135 fallback_wrapper_.Encode(*frame_, nullptr, &types)); |
135 } | 136 } |
136 | 137 |
137 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { | 138 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { |
138 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_); | 139 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_); |
139 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_); | 140 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 292 |
292 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, | 293 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
293 ReportsFallbackImplementationName) { | 294 ReportsFallbackImplementationName) { |
294 UtilizeFallbackEncoder(); | 295 UtilizeFallbackEncoder(); |
295 // Hard coded expected value since libvpx is the software implementation name | 296 // Hard coded expected value since libvpx is the software implementation name |
296 // for VP8. Change accordingly if the underlying implementation does. | 297 // for VP8. Change accordingly if the underlying implementation does. |
297 CheckLastEncoderName("libvpx"); | 298 CheckLastEncoderName("libvpx"); |
298 } | 299 } |
299 | 300 |
300 } // namespace webrtc | 301 } // namespace webrtc |
OLD | NEW |