| 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 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 FakeEncodedImageCallback callback_; | 100 FakeEncodedImageCallback callback_; |
| 101 CountingFakeEncoder fake_encoder_; | 101 CountingFakeEncoder fake_encoder_; |
| 102 VideoEncoderSoftwareFallbackWrapper fallback_wrapper_; | 102 VideoEncoderSoftwareFallbackWrapper fallback_wrapper_; |
| 103 VideoCodec codec_ = {}; | 103 VideoCodec codec_ = {}; |
| 104 VideoFrame frame_; | 104 VideoFrame frame_; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { | 107 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { |
| 108 frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, (kWidth + 1) / 2, | 108 frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, (kWidth + 1) / 2, |
| 109 (kWidth + 1) / 2); | 109 (kWidth + 1) / 2); |
| 110 memset(frame_.buffer(webrtc::kYPlane), 16, | 110 memset(frame_.video_frame_buffer()->MutableDataY(), 16, |
| 111 frame_.allocated_size(webrtc::kYPlane)); | 111 frame_.allocated_size(webrtc::kYPlane)); |
| 112 memset(frame_.buffer(webrtc::kUPlane), 128, | 112 memset(frame_.video_frame_buffer()->MutableDataU(), 128, |
| 113 frame_.allocated_size(webrtc::kUPlane)); | 113 frame_.allocated_size(webrtc::kUPlane)); |
| 114 memset(frame_.buffer(webrtc::kVPlane), 128, | 114 memset(frame_.video_frame_buffer()->MutableDataV(), 128, |
| 115 frame_.allocated_size(webrtc::kVPlane)); | 115 frame_.allocated_size(webrtc::kVPlane)); |
| 116 | 116 |
| 117 std::vector<FrameType> types(1, kVideoFrameKey); | 117 std::vector<FrameType> types(1, kVideoFrameKey); |
| 118 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 118 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
| 119 fallback_wrapper_.Encode(frame_, nullptr, &types)); | 119 fallback_wrapper_.Encode(frame_, nullptr, &types)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { | 122 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { |
| 123 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_); | 123 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_); |
| 124 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_); | 124 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, | 266 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
| 267 ReportsFallbackImplementationName) { | 267 ReportsFallbackImplementationName) { |
| 268 UtilizeFallbackEncoder(); | 268 UtilizeFallbackEncoder(); |
| 269 // Hard coded expected value since libvpx is the software implementation name | 269 // Hard coded expected value since libvpx is the software implementation name |
| 270 // for VP8. Change accordingly if the underlying implementation does. | 270 // for VP8. Change accordingly if the underlying implementation does. |
| 271 EXPECT_STREQ("libvpx (fallback from: fake-encoder)", | 271 EXPECT_STREQ("libvpx (fallback from: fake-encoder)", |
| 272 fallback_wrapper_.ImplementationName()); | 272 fallback_wrapper_.ImplementationName()); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace webrtc | 275 } // namespace webrtc |
| OLD | NEW |