Erik Språng | c84cd95 | 2018-10-15 11:55:13 +0200 | [diff] [blame^] | 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_DECODER_H_ |
| 12 | #define API_TEST_MOCK_VIDEO_DECODER_H_ |
| 13 | |
| 14 | #include "api/video_codecs/video_decoder.h" |
| 15 | #include "test/gmock.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
| 19 | class MockDecodedImageCallback : public DecodedImageCallback { |
| 20 | public: |
| 21 | MockDecodedImageCallback(); |
| 22 | ~MockDecodedImageCallback() override; |
| 23 | |
| 24 | MOCK_METHOD1(Decoded, int32_t(VideoFrame& decodedImage)); // NOLINT |
| 25 | MOCK_METHOD2(Decoded, |
| 26 | int32_t(VideoFrame& decodedImage, // NOLINT |
| 27 | int64_t decode_time_ms)); |
| 28 | MOCK_METHOD3(Decoded, |
| 29 | void(VideoFrame& decodedImage, // NOLINT |
| 30 | absl::optional<int32_t> decode_time_ms, |
| 31 | absl::optional<uint8_t> qp)); |
| 32 | MOCK_METHOD1(ReceivedDecodedReferenceFrame, |
| 33 | int32_t(const uint64_t pictureId)); |
| 34 | MOCK_METHOD1(ReceivedDecodedFrame, int32_t(const uint64_t pictureId)); |
| 35 | }; |
| 36 | |
| 37 | class MockVideoDecoder : public VideoDecoder { |
| 38 | public: |
| 39 | MockVideoDecoder(); |
| 40 | ~MockVideoDecoder() override; |
| 41 | |
| 42 | MOCK_METHOD2(InitDecode, |
| 43 | int32_t(const VideoCodec* codecSettings, int32_t numberOfCores)); |
| 44 | MOCK_METHOD4(Decode, |
| 45 | int32_t(const EncodedImage& inputImage, |
| 46 | bool missingFrames, |
| 47 | const CodecSpecificInfo* codecSpecificInfo, |
| 48 | int64_t renderTimeMs)); |
| 49 | MOCK_METHOD1(RegisterDecodeCompleteCallback, |
| 50 | int32_t(DecodedImageCallback* callback)); |
| 51 | MOCK_METHOD0(Release, int32_t()); |
| 52 | MOCK_METHOD0(Copy, VideoDecoder*()); |
| 53 | }; |
| 54 | |
| 55 | } // namespace webrtc |
| 56 | |
| 57 | #endif // API_TEST_MOCK_VIDEO_DECODER_H_ |