mock_video_stream_encoder.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 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 VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_
  11. #define VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_
  12. #include <vector>
  13. #include "api/video/video_stream_encoder_interface.h"
  14. #include "test/gmock.h"
  15. namespace webrtc {
  16. class MockVideoStreamEncoder : public VideoStreamEncoderInterface {
  17. public:
  18. MOCK_METHOD(void,
  19. AddAdaptationResource,
  20. (rtc::scoped_refptr<Resource>),
  21. (override));
  22. MOCK_METHOD(std::vector<rtc::scoped_refptr<Resource>>,
  23. GetAdaptationResources,
  24. (),
  25. (override));
  26. MOCK_METHOD(void,
  27. SetSource,
  28. (rtc::VideoSourceInterface<VideoFrame>*,
  29. const DegradationPreference&),
  30. (override));
  31. MOCK_METHOD(void, SetSink, (EncoderSink*, bool), (override));
  32. MOCK_METHOD(void, SetStartBitrate, (int), (override));
  33. MOCK_METHOD(void, SendKeyFrame, (), (override));
  34. MOCK_METHOD(void,
  35. OnLossNotification,
  36. (const VideoEncoder::LossNotification&),
  37. (override));
  38. MOCK_METHOD(void,
  39. OnBitrateUpdated,
  40. (DataRate, DataRate, DataRate, uint8_t, int64_t, double),
  41. (override));
  42. MOCK_METHOD(void, OnFrame, (const VideoFrame&), (override));
  43. MOCK_METHOD(void,
  44. SetBitrateAllocationObserver,
  45. (VideoBitrateAllocationObserver*),
  46. (override));
  47. MOCK_METHOD(void,
  48. SetFecControllerOverride,
  49. (FecControllerOverride*),
  50. (override));
  51. MOCK_METHOD(void, Stop, (), (override));
  52. MOCK_METHOD(void,
  53. MockedConfigureEncoder,
  54. (const VideoEncoderConfig&, size_t));
  55. // gtest generates implicit copy which is not allowed on VideoEncoderConfig,
  56. // so we can't mock ConfigureEncoder directly.
  57. void ConfigureEncoder(VideoEncoderConfig config,
  58. size_t max_data_payload_length) {
  59. MockedConfigureEncoder(config, max_data_payload_length);
  60. }
  61. };
  62. } // namespace webrtc
  63. #endif // VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_