1 /*
2  *  Copyright (c) 2012 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 WEBRTC_MODULES_VIDEO_CODING_INCLUDE_MOCK_MOCK_VIDEO_CODEC_INTERFACE_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_MOCK_MOCK_VIDEO_CODEC_INTERFACE_H_
13 
14 #include <string>
15 #include <vector>
16 
17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
19 #include "webrtc/typedefs.h"
20 
21 namespace webrtc {
22 
23 class MockEncodedImageCallback : public EncodedImageCallback {
24  public:
25   MOCK_METHOD3(Encoded,
26                int32_t(const EncodedImage& encodedImage,
27                        const CodecSpecificInfo* codecSpecificInfo,
28                        const RTPFragmentationHeader* fragmentation));
29 };
30 
31 class MockVideoEncoder : public VideoEncoder {
32  public:
33   MOCK_CONST_METHOD2(Version, int32_t(int8_t* version, int32_t length));
34   MOCK_METHOD3(InitEncode,
35                int32_t(const VideoCodec* codecSettings,
36                        int32_t numberOfCores,
37                        size_t maxPayloadSize));
38   MOCK_METHOD3(Encode,
39                int32_t(const VideoFrame& inputImage,
40                        const CodecSpecificInfo* codecSpecificInfo,
41                        const std::vector<FrameType>* frame_types));
42   MOCK_METHOD1(RegisterEncodeCompleteCallback,
43                int32_t(EncodedImageCallback* callback));
44   MOCK_METHOD0(Release, int32_t());
45   MOCK_METHOD0(Reset, int32_t());
46   MOCK_METHOD2(SetChannelParameters, int32_t(uint32_t packetLoss, int64_t rtt));
47   MOCK_METHOD2(SetRates, int32_t(uint32_t newBitRate, uint32_t frameRate));
48   MOCK_METHOD1(SetPeriodicKeyFrames, int32_t(bool enable));
49 };
50 
51 class MockDecodedImageCallback : public DecodedImageCallback {
52  public:
53   MOCK_METHOD1(Decoded, int32_t(VideoFrame& decodedImage));  // NOLINT
54   MOCK_METHOD2(Decoded,
55                int32_t(VideoFrame& decodedImage,  // NOLINT
56                        int64_t decode_time_ms));
57   MOCK_METHOD1(ReceivedDecodedReferenceFrame,
58                int32_t(const uint64_t pictureId));
59   MOCK_METHOD1(ReceivedDecodedFrame, int32_t(const uint64_t pictureId));
60 };
61 
62 class MockVideoDecoder : public VideoDecoder {
63  public:
64   MOCK_METHOD2(InitDecode,
65                int32_t(const VideoCodec* codecSettings, int32_t numberOfCores));
66   MOCK_METHOD5(Decode,
67                int32_t(const EncodedImage& inputImage,
68                        bool missingFrames,
69                        const RTPFragmentationHeader* fragmentation,
70                        const CodecSpecificInfo* codecSpecificInfo,
71                        int64_t renderTimeMs));
72   MOCK_METHOD1(RegisterDecodeCompleteCallback,
73                int32_t(DecodedImageCallback* callback));
74   MOCK_METHOD0(Release, int32_t());
75   MOCK_METHOD0(Reset, int32_t());
76   MOCK_METHOD0(Copy, VideoDecoder*());
77 };
78 
79 }  // namespace webrtc
80 
81 #endif  // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_MOCK_MOCK_VIDEO_CODEC_INTERFACE_H_
82