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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { | 103 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { |
104 frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, (kWidth + 1) / 2, | 104 frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, (kWidth + 1) / 2, |
105 (kWidth + 1) / 2); | 105 (kWidth + 1) / 2); |
106 memset(frame_.buffer(webrtc::kYPlane), 16, | 106 memset(frame_.buffer(webrtc::kYPlane), 16, |
107 frame_.allocated_size(webrtc::kYPlane)); | 107 frame_.allocated_size(webrtc::kYPlane)); |
108 memset(frame_.buffer(webrtc::kUPlane), 128, | 108 memset(frame_.buffer(webrtc::kUPlane), 128, |
109 frame_.allocated_size(webrtc::kUPlane)); | 109 frame_.allocated_size(webrtc::kUPlane)); |
110 memset(frame_.buffer(webrtc::kVPlane), 128, | 110 memset(frame_.buffer(webrtc::kVPlane), 128, |
111 frame_.allocated_size(webrtc::kVPlane)); | 111 frame_.allocated_size(webrtc::kVPlane)); |
112 | 112 |
113 std::vector<FrameType> types(1, kKeyFrame); | 113 std::vector<FrameType> types(1, kVideoFrameKey); |
114 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 114 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
115 fallback_wrapper_.Encode(frame_, nullptr, &types)); | 115 fallback_wrapper_.Encode(frame_, nullptr, &types)); |
116 } | 116 } |
117 | 117 |
118 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { | 118 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { |
119 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_); | 119 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_); |
120 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_); | 120 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_); |
121 | 121 |
122 // Register with failing fake encoder. Should succeed with VP8 fallback. | 122 // Register with failing fake encoder. Should succeed with VP8 fallback. |
123 codec_.codecType = kVideoCodecVP8; | 123 codec_.codecType = kVideoCodecVP8; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, | 198 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
199 CanRegisterCallbackWhileUsingFallbackEncoder) { | 199 CanRegisterCallbackWhileUsingFallbackEncoder) { |
200 UtilizeFallbackEncoder(); | 200 UtilizeFallbackEncoder(); |
201 // Registering an encode-complete callback should still work when fallback | 201 // Registering an encode-complete callback should still work when fallback |
202 // encoder is being used. | 202 // encoder is being used. |
203 FakeEncodedImageCallback callback2; | 203 FakeEncodedImageCallback callback2; |
204 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback2); | 204 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback2); |
205 EXPECT_EQ(&callback2, fake_encoder_.encode_complete_callback_); | 205 EXPECT_EQ(&callback2, fake_encoder_.encode_complete_callback_); |
206 | 206 |
207 // Encoding a frame using the fallback should arrive at the new callback. | 207 // Encoding a frame using the fallback should arrive at the new callback. |
208 std::vector<FrameType> types(1, kKeyFrame); | 208 std::vector<FrameType> types(1, kVideoFrameKey); |
209 frame_.set_timestamp(frame_.timestamp() + 1000); | 209 frame_.set_timestamp(frame_.timestamp() + 1000); |
210 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, | 210 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
211 fallback_wrapper_.Encode(frame_, nullptr, &types)); | 211 fallback_wrapper_.Encode(frame_, nullptr, &types)); |
212 | 212 |
213 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); | 213 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); |
214 } | 214 } |
215 | 215 |
216 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, | 216 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
217 SetChannelParametersForwardedDuringFallback) { | 217 SetChannelParametersForwardedDuringFallback) { |
218 UtilizeFallbackEncoder(); | 218 UtilizeFallbackEncoder(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, | 254 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
255 SupportsNativeHandleNotForwardedDuringFallback) { | 255 SupportsNativeHandleNotForwardedDuringFallback) { |
256 UtilizeFallbackEncoder(); | 256 UtilizeFallbackEncoder(); |
257 fallback_wrapper_.SupportsNativeHandle(); | 257 fallback_wrapper_.SupportsNativeHandle(); |
258 EXPECT_EQ(0, fake_encoder_.supports_native_handle_count_); | 258 EXPECT_EQ(0, fake_encoder_.supports_native_handle_count_); |
259 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); | 259 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); |
260 } | 260 } |
261 | 261 |
262 } // namespace webrtc | 262 } // namespace webrtc |
OLD | NEW |