mock_video_encoder.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
  3. *
  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
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef API_TEST_MOCK_VIDEO_ENCODER_H_
  11. #define API_TEST_MOCK_VIDEO_ENCODER_H_
  12. #include <vector>
  13. #include "api/video_codecs/video_encoder.h"
  14. #include "test/gmock.h"
  15. namespace webrtc {
  16. class MockEncodedImageCallback : public EncodedImageCallback {
  17. public:
  18. MOCK_METHOD(Result,
  19. OnEncodedImage,
  20. (const EncodedImage& encodedImage,
  21. const CodecSpecificInfo*,
  22. const RTPFragmentationHeader*),
  23. (override));
  24. MOCK_METHOD(void, OnDroppedFrame, (DropReason reason), (override));
  25. };
  26. class MockVideoEncoder : public VideoEncoder {
  27. public:
  28. MOCK_METHOD(void,
  29. SetFecControllerOverride,
  30. (FecControllerOverride*),
  31. (override));
  32. MOCK_METHOD(int32_t,
  33. InitEncode,
  34. (const VideoCodec*, int32_t numberOfCores, size_t maxPayloadSize),
  35. (override));
  36. MOCK_METHOD(int32_t,
  37. InitEncode,
  38. (const VideoCodec*, const VideoEncoder::Settings& settings),
  39. (override));
  40. MOCK_METHOD(int32_t,
  41. Encode,
  42. (const VideoFrame& inputImage,
  43. const std::vector<VideoFrameType>*),
  44. (override));
  45. MOCK_METHOD(int32_t,
  46. RegisterEncodeCompleteCallback,
  47. (EncodedImageCallback*),
  48. (override));
  49. MOCK_METHOD(int32_t, Release, (), (override));
  50. MOCK_METHOD(void,
  51. SetRates,
  52. (const RateControlParameters& parameters),
  53. (override));
  54. MOCK_METHOD(void,
  55. OnPacketLossRateUpdate,
  56. (float packet_loss_rate),
  57. (override));
  58. MOCK_METHOD(void, OnRttUpdate, (int64_t rtt_ms), (override));
  59. MOCK_METHOD(void,
  60. OnLossNotification,
  61. (const LossNotification& loss_notification),
  62. (override));
  63. MOCK_METHOD(EncoderInfo, GetEncoderInfo, (), (const, override));
  64. };
  65. } // namespace webrtc
  66. #endif // API_TEST_MOCK_VIDEO_ENCODER_H_