Sebastian Jansson | 652dc91 | 2018-04-19 15:09:15 | [diff] [blame] | 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 | |
Henrik Boström | f4a9991 | 2020-06-11 10:07:14 | [diff] [blame] | 13 | #include <vector> |
| 14 | |
Sebastian Jansson | 652dc91 | 2018-04-19 15:09:15 | [diff] [blame] | 15 | #include "test/gmock.h" |
Jonas Oreland | 6c2dae2 | 2022-09-29 08:28:24 | [diff] [blame] | 16 | #include "video/video_stream_encoder_interface.h" |
Sebastian Jansson | 652dc91 | 2018-04-19 15:09:15 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | class MockVideoStreamEncoder : public VideoStreamEncoderInterface { |
| 21 | public: |
Danil Chapovalov | 91fdc60 | 2020-05-14 17:17:51 | [diff] [blame] | 22 | MOCK_METHOD(void, |
Henrik Boström | f4a9991 | 2020-06-11 10:07:14 | [diff] [blame] | 23 | AddAdaptationResource, |
| 24 | (rtc::scoped_refptr<Resource>), |
| 25 | (override)); |
| 26 | MOCK_METHOD(std::vector<rtc::scoped_refptr<Resource>>, |
| 27 | GetAdaptationResources, |
| 28 | (), |
| 29 | (override)); |
| 30 | MOCK_METHOD(void, |
Danil Chapovalov | 91fdc60 | 2020-05-14 17:17:51 | [diff] [blame] | 31 | SetSource, |
| 32 | (rtc::VideoSourceInterface<VideoFrame>*, |
| 33 | const DegradationPreference&), |
| 34 | (override)); |
| 35 | MOCK_METHOD(void, SetSink, (EncoderSink*, bool), (override)); |
| 36 | MOCK_METHOD(void, SetStartBitrate, (int), (override)); |
Philipp Hancke | a1b4eb2 | 2022-11-04 13:45:23 | [diff] [blame] | 37 | MOCK_METHOD(void, |
| 38 | SendKeyFrame, |
| 39 | (const std::vector<VideoFrameType>&), |
| 40 | (override)); |
Danil Chapovalov | 91fdc60 | 2020-05-14 17:17:51 | [diff] [blame] | 41 | MOCK_METHOD(void, |
| 42 | OnLossNotification, |
| 43 | (const VideoEncoder::LossNotification&), |
| 44 | (override)); |
| 45 | MOCK_METHOD(void, |
| 46 | OnBitrateUpdated, |
| 47 | (DataRate, DataRate, DataRate, uint8_t, int64_t, double), |
| 48 | (override)); |
Danil Chapovalov | 91fdc60 | 2020-05-14 17:17:51 | [diff] [blame] | 49 | MOCK_METHOD(void, |
Danil Chapovalov | 91fdc60 | 2020-05-14 17:17:51 | [diff] [blame] | 50 | SetFecControllerOverride, |
| 51 | (FecControllerOverride*), |
| 52 | (override)); |
| 53 | MOCK_METHOD(void, Stop, (), (override)); |
Sebastian Jansson | 652dc91 | 2018-04-19 15:09:15 | [diff] [blame] | 54 | |
Danil Chapovalov | 91fdc60 | 2020-05-14 17:17:51 | [diff] [blame] | 55 | MOCK_METHOD(void, |
| 56 | MockedConfigureEncoder, |
| 57 | (const VideoEncoderConfig&, size_t)); |
Florent Castelli | acabb36 | 2022-10-18 15:05:16 | [diff] [blame] | 58 | MOCK_METHOD(void, |
| 59 | MockedConfigureEncoder, |
| 60 | (const VideoEncoderConfig&, size_t, SetParametersCallback)); |
Sebastian Jansson | 652dc91 | 2018-04-19 15:09:15 | [diff] [blame] | 61 | // gtest generates implicit copy which is not allowed on VideoEncoderConfig, |
| 62 | // so we can't mock ConfigureEncoder directly. |
| 63 | void ConfigureEncoder(VideoEncoderConfig config, |
Niels Möller | f133856 | 2018-04-26 07:51:47 | [diff] [blame] | 64 | size_t max_data_payload_length) { |
| 65 | MockedConfigureEncoder(config, max_data_payload_length); |
Sebastian Jansson | 652dc91 | 2018-04-19 15:09:15 | [diff] [blame] | 66 | } |
Florent Castelli | acabb36 | 2022-10-18 15:05:16 | [diff] [blame] | 67 | void ConfigureEncoder(VideoEncoderConfig config, |
| 68 | size_t max_data_payload_length, |
| 69 | SetParametersCallback) { |
| 70 | MockedConfigureEncoder(config, max_data_payload_length); |
| 71 | } |
Sebastian Jansson | 652dc91 | 2018-04-19 15:09:15 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | } // namespace webrtc |
| 75 | |
| 76 | #endif // VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_ |