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