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 13 #include <vector> 14 15 #include "test/gmock.h" 16 #include "video/video_stream_encoder_interface.h" 17 18 namespace webrtc { 19 20 class MockVideoStreamEncoder : public VideoStreamEncoderInterface { 21 public: 22 MOCK_METHOD(void, 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, 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)); 37 MOCK_METHOD(void, 38 SendKeyFrame, 39 (const std::vector<VideoFrameType>&), 40 (override)); 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)); 49 MOCK_METHOD(void, 50 SetFecControllerOverride, 51 (FecControllerOverride*), 52 (override)); 53 MOCK_METHOD(void, Stop, (), (override)); 54 55 MOCK_METHOD(void, 56 MockedConfigureEncoder, 57 (const VideoEncoderConfig&, size_t)); 58 MOCK_METHOD(void, 59 MockedConfigureEncoder, 60 (const VideoEncoderConfig&, size_t, SetParametersCallback)); 61 // gtest generates implicit copy which is not allowed on VideoEncoderConfig, 62 // so we can't mock ConfigureEncoder directly. ConfigureEncoder(VideoEncoderConfig config,size_t max_data_payload_length)63 void ConfigureEncoder(VideoEncoderConfig config, 64 size_t max_data_payload_length) { 65 MockedConfigureEncoder(config, max_data_payload_length); 66 } ConfigureEncoder(VideoEncoderConfig config,size_t max_data_payload_length,SetParametersCallback)67 void ConfigureEncoder(VideoEncoderConfig config, 68 size_t max_data_payload_length, 69 SetParametersCallback) { 70 MockedConfigureEncoder(config, max_data_payload_length); 71 } 72 }; 73 74 } // namespace webrtc 75 76 #endif // VIDEO_TEST_MOCK_VIDEO_STREAM_ENCODER_H_ 77