mock_video_encoder.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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&, const CodecSpecificInfo*),
  21. (override));
  22. MOCK_METHOD(void, OnDroppedFrame, (DropReason reason), (override));
  23. };
  24. class MockVideoEncoder : public VideoEncoder {
  25. public:
  26. MOCK_METHOD(void,
  27. SetFecControllerOverride,
  28. (FecControllerOverride*),
  29. (override));
  30. MOCK_METHOD(int32_t,
  31. InitEncode,
  32. (const VideoCodec*, int32_t numberOfCores, size_t maxPayloadSize),
  33. (override));
  34. MOCK_METHOD(int32_t,
  35. InitEncode,
  36. (const VideoCodec*, const VideoEncoder::Settings& settings),
  37. (override));
  38. MOCK_METHOD(int32_t,
  39. Encode,
  40. (const VideoFrame& inputImage,
  41. const std::vector<VideoFrameType>*),
  42. (override));
  43. MOCK_METHOD(int32_t,
  44. RegisterEncodeCompleteCallback,
  45. (EncodedImageCallback*),
  46. (override));
  47. MOCK_METHOD(int32_t, Release, (), (override));
  48. MOCK_METHOD(void,
  49. SetRates,
  50. (const RateControlParameters& parameters),
  51. (override));
  52. MOCK_METHOD(void,
  53. OnPacketLossRateUpdate,
  54. (float packet_loss_rate),
  55. (override));
  56. MOCK_METHOD(void, OnRttUpdate, (int64_t rtt_ms), (override));
  57. MOCK_METHOD(void,
  58. OnLossNotification,
  59. (const LossNotification& loss_notification),
  60. (override));
  61. MOCK_METHOD(EncoderInfo, GetEncoderInfo, (), (const, override));
  62. };
  63. } // namespace webrtc
  64. #endif // API_TEST_MOCK_VIDEO_ENCODER_H_