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