Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Side by Side Diff: webrtc/media/engine/videoencodersoftwarefallbackwrapper_unittest.cc

Issue 2398963003: Move usage of QualityScaler to ViEEncoder. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ++set_channel_parameters_count_; 67 ++set_channel_parameters_count_;
68 return WEBRTC_VIDEO_CODEC_OK; 68 return WEBRTC_VIDEO_CODEC_OK;
69 } 69 }
70 70
71 int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation, 71 int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
72 uint32_t framerate) override { 72 uint32_t framerate) override {
73 ++set_rates_count_; 73 ++set_rates_count_;
74 return WEBRTC_VIDEO_CODEC_OK; 74 return WEBRTC_VIDEO_CODEC_OK;
75 } 75 }
76 76
77 void OnDroppedFrame() override { ++on_dropped_frame_count_; }
78
79 bool SupportsNativeHandle() const override { 77 bool SupportsNativeHandle() const override {
80 ++supports_native_handle_count_; 78 ++supports_native_handle_count_;
81 return false; 79 return false;
82 } 80 }
83 81
84 const char* ImplementationName() const override { 82 const char* ImplementationName() const override {
85 return "fake-encoder"; 83 return "fake-encoder";
86 } 84 }
87 85
88 int init_encode_count_ = 0; 86 int init_encode_count_ = 0;
89 int32_t init_encode_return_code_ = WEBRTC_VIDEO_CODEC_OK; 87 int32_t init_encode_return_code_ = WEBRTC_VIDEO_CODEC_OK;
90 int32_t encode_return_code_ = WEBRTC_VIDEO_CODEC_OK; 88 int32_t encode_return_code_ = WEBRTC_VIDEO_CODEC_OK;
91 int encode_count_ = 0; 89 int encode_count_ = 0;
92 EncodedImageCallback* encode_complete_callback_ = nullptr; 90 EncodedImageCallback* encode_complete_callback_ = nullptr;
93 int release_count_ = 0; 91 int release_count_ = 0;
94 int set_channel_parameters_count_ = 0; 92 int set_channel_parameters_count_ = 0;
95 int set_rates_count_ = 0; 93 int set_rates_count_ = 0;
96 int on_dropped_frame_count_ = 0;
97 mutable int supports_native_handle_count_ = 0; 94 mutable int supports_native_handle_count_ = 0;
98 }; 95 };
99 96
100 class FakeEncodedImageCallback : public EncodedImageCallback { 97 class FakeEncodedImageCallback : public EncodedImageCallback {
101 public: 98 public:
102 Result OnEncodedImage( 99 Result OnEncodedImage(
103 const EncodedImage& encoded_image, 100 const EncodedImage& encoded_image,
104 const CodecSpecificInfo* codec_specific_info, 101 const CodecSpecificInfo* codec_specific_info,
105 const RTPFragmentationHeader* fragmentation) override { 102 const RTPFragmentationHeader* fragmentation) override {
106 ++callback_count_; 103 ++callback_count_;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, 261 TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
265 SetRatesForwardedDuringFallback) { 262 SetRatesForwardedDuringFallback) {
266 UtilizeFallbackEncoder(); 263 UtilizeFallbackEncoder();
267 EXPECT_EQ(1, fake_encoder_.set_rates_count_); 264 EXPECT_EQ(1, fake_encoder_.set_rates_count_);
268 fallback_wrapper_.SetRateAllocation(BitrateAllocation(), 1); 265 fallback_wrapper_.SetRateAllocation(BitrateAllocation(), 1);
269 EXPECT_EQ(2, fake_encoder_.set_rates_count_); 266 EXPECT_EQ(2, fake_encoder_.set_rates_count_);
270 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); 267 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release());
271 } 268 }
272 269
273 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, 270 TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
274 OnDroppedFrameForwardedWithoutFallback) {
275 fallback_wrapper_.OnDroppedFrame();
276 EXPECT_EQ(1, fake_encoder_.on_dropped_frame_count_);
277 }
278
279 TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
280 OnDroppedFrameNotForwardedDuringFallback) {
281 UtilizeFallbackEncoder();
282 fallback_wrapper_.OnDroppedFrame();
283 EXPECT_EQ(0, fake_encoder_.on_dropped_frame_count_);
284 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release());
285 }
286
287 TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
288 SupportsNativeHandleForwardedWithoutFallback) { 271 SupportsNativeHandleForwardedWithoutFallback) {
289 fallback_wrapper_.SupportsNativeHandle(); 272 fallback_wrapper_.SupportsNativeHandle();
290 EXPECT_EQ(1, fake_encoder_.supports_native_handle_count_); 273 EXPECT_EQ(1, fake_encoder_.supports_native_handle_count_);
291 } 274 }
292 275
293 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, 276 TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
294 SupportsNativeHandleNotForwardedDuringFallback) { 277 SupportsNativeHandleNotForwardedDuringFallback) {
295 UtilizeFallbackEncoder(); 278 UtilizeFallbackEncoder();
296 fallback_wrapper_.SupportsNativeHandle(); 279 fallback_wrapper_.SupportsNativeHandle();
297 EXPECT_EQ(0, fake_encoder_.supports_native_handle_count_); 280 EXPECT_EQ(0, fake_encoder_.supports_native_handle_count_);
(...skipping 10 matching lines...) Expand all
308 291
309 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, 292 TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
310 ReportsFallbackImplementationName) { 293 ReportsFallbackImplementationName) {
311 UtilizeFallbackEncoder(); 294 UtilizeFallbackEncoder();
312 // Hard coded expected value since libvpx is the software implementation name 295 // Hard coded expected value since libvpx is the software implementation name
313 // for VP8. Change accordingly if the underlying implementation does. 296 // for VP8. Change accordingly if the underlying implementation does.
314 CheckLastEncoderName("libvpx"); 297 CheckLastEncoderName("libvpx");
315 } 298 }
316 299
317 } // namespace webrtc 300 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698