xref: /aosp_15_r20/external/webrtc/api/test/mock_video_encoder.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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 
11 #ifndef API_TEST_MOCK_VIDEO_ENCODER_H_
12 #define API_TEST_MOCK_VIDEO_ENCODER_H_
13 
14 #include <vector>
15 
16 #include "api/video_codecs/video_encoder.h"
17 #include "test/gmock.h"
18 
19 namespace webrtc {
20 
21 class MockEncodedImageCallback : public EncodedImageCallback {
22  public:
23   MOCK_METHOD(Result,
24               OnEncodedImage,
25               (const EncodedImage&, const CodecSpecificInfo*),
26               (override));
27   MOCK_METHOD(void, OnDroppedFrame, (DropReason reason), (override));
28 };
29 
30 class MockVideoEncoder : public VideoEncoder {
31  public:
32   MOCK_METHOD(void,
33               SetFecControllerOverride,
34               (FecControllerOverride*),
35               (override));
36   MOCK_METHOD(int32_t,
37               InitEncode,
38               (const VideoCodec*, int32_t numberOfCores, size_t maxPayloadSize),
39               (override));
40   MOCK_METHOD(int32_t,
41               InitEncode,
42               (const VideoCodec*, const VideoEncoder::Settings& settings),
43               (override));
44 
45   MOCK_METHOD(int32_t,
46               Encode,
47               (const VideoFrame& inputImage,
48                const std::vector<VideoFrameType>*),
49               (override));
50   MOCK_METHOD(int32_t,
51               RegisterEncodeCompleteCallback,
52               (EncodedImageCallback*),
53               (override));
54   MOCK_METHOD(int32_t, Release, (), (override));
55   MOCK_METHOD(void,
56               SetRates,
57               (const RateControlParameters& parameters),
58               (override));
59   MOCK_METHOD(void,
60               OnPacketLossRateUpdate,
61               (float packet_loss_rate),
62               (override));
63   MOCK_METHOD(void, OnRttUpdate, (int64_t rtt_ms), (override));
64   MOCK_METHOD(void,
65               OnLossNotification,
66               (const LossNotification& loss_notification),
67               (override));
68   MOCK_METHOD(EncoderInfo, GetEncoderInfo, (), (const, override));
69 };
70 
71 }  // namespace webrtc
72 
73 #endif  // API_TEST_MOCK_VIDEO_ENCODER_H_
74