| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return WEBRTC_VIDEO_CODEC_OK; | 53 return WEBRTC_VIDEO_CODEC_OK; |
| 54 } | 54 } |
| 55 | 55 |
| 56 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override { | 56 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override { |
| 57 ++set_rates_count_; | 57 ++set_rates_count_; |
| 58 return WEBRTC_VIDEO_CODEC_OK; | 58 return WEBRTC_VIDEO_CODEC_OK; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void OnDroppedFrame() override { ++on_dropped_frame_count_; } | 61 void OnDroppedFrame() override { ++on_dropped_frame_count_; } |
| 62 | 62 |
| 63 bool SupportsNativeHandle() const override { |
| 64 ++supports_native_handle_count_; |
| 65 return false; |
| 66 } |
| 67 |
| 63 int init_encode_count_ = 0; | 68 int init_encode_count_ = 0; |
| 64 int32_t init_encode_return_code_ = WEBRTC_VIDEO_CODEC_OK; | 69 int32_t init_encode_return_code_ = WEBRTC_VIDEO_CODEC_OK; |
| 65 int encode_count_ = 0; | 70 int encode_count_ = 0; |
| 66 EncodedImageCallback* encode_complete_callback_ = nullptr; | 71 EncodedImageCallback* encode_complete_callback_ = nullptr; |
| 67 int release_count_ = 0; | 72 int release_count_ = 0; |
| 68 int set_channel_parameters_count_ = 0; | 73 int set_channel_parameters_count_ = 0; |
| 69 int set_rates_count_ = 0; | 74 int set_rates_count_ = 0; |
| 70 int on_dropped_frame_count_ = 0; | 75 int on_dropped_frame_count_ = 0; |
| 76 mutable int supports_native_handle_count_ = 0; |
| 71 }; | 77 }; |
| 72 | 78 |
| 73 class FakeEncodedImageCallback : public EncodedImageCallback { | 79 class FakeEncodedImageCallback : public EncodedImageCallback { |
| 74 public: | 80 public: |
| 75 int32_t Encoded(const EncodedImage& encoded_image, | 81 int32_t Encoded(const EncodedImage& encoded_image, |
| 76 const CodecSpecificInfo* codec_specific_info, | 82 const CodecSpecificInfo* codec_specific_info, |
| 77 const RTPFragmentationHeader* fragmentation) override { | 83 const RTPFragmentationHeader* fragmentation) override { |
| 78 return ++callback_count_; | 84 return ++callback_count_; |
| 79 } | 85 } |
| 80 int callback_count_ = 0; | 86 int callback_count_ = 0; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 196 } |
| 191 | 197 |
| 192 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, | 198 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
| 193 OnDroppedFrameNotForwardedDuringFallback) { | 199 OnDroppedFrameNotForwardedDuringFallback) { |
| 194 UtilizeFallbackEncoder(); | 200 UtilizeFallbackEncoder(); |
| 195 fallback_wrapper_.OnDroppedFrame(); | 201 fallback_wrapper_.OnDroppedFrame(); |
| 196 EXPECT_EQ(0, fake_encoder_.on_dropped_frame_count_); | 202 EXPECT_EQ(0, fake_encoder_.on_dropped_frame_count_); |
| 197 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); | 203 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); |
| 198 } | 204 } |
| 199 | 205 |
| 206 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
| 207 SupportsNativeHandleForwardedWithoutFallback) { |
| 208 fallback_wrapper_.SupportsNativeHandle(); |
| 209 EXPECT_EQ(1, fake_encoder_.supports_native_handle_count_); |
| 210 } |
| 211 |
| 212 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, |
| 213 SupportsNativeHandleNotForwardedDuringFallback) { |
| 214 UtilizeFallbackEncoder(); |
| 215 fallback_wrapper_.SupportsNativeHandle(); |
| 216 EXPECT_EQ(0, fake_encoder_.supports_native_handle_count_); |
| 217 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); |
| 218 } |
| 219 |
| 200 } // namespace webrtc | 220 } // namespace webrtc |
| OLD | NEW |