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