pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef TEST_FAKE_DECODER_H_ |
| 12 | #define TEST_FAKE_DECODER_H_ |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 13 | |
Yves Gerey | 3e70781 | 2018-11-28 15:47:49 | [diff] [blame] | 14 | #include <stdint.h> |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 15 | |
Ilya Nikolaevskiy | 2ebf523 | 2019-05-13 14:13:36 | [diff] [blame] | 16 | #include "api/task_queue/task_queue_factory.h" |
Yves Gerey | 3e70781 | 2018-11-28 15:47:49 | [diff] [blame] | 17 | #include "api/video/encoded_image.h" |
| 18 | #include "api/video_codecs/video_codec.h" |
| 19 | #include "api/video_codecs/video_decoder.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 20 | #include "modules/video_coding/include/video_codec_interface.h" |
Ilya Nikolaevskiy | 2ebf523 | 2019-05-13 14:13:36 | [diff] [blame] | 21 | #include "rtc_base/task_queue.h" |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | namespace test { |
| 25 | |
| 26 | class FakeDecoder : public VideoDecoder { |
| 27 | public: |
| 28 | FakeDecoder(); |
Ilya Nikolaevskiy | 2ebf523 | 2019-05-13 14:13:36 | [diff] [blame] | 29 | explicit FakeDecoder(TaskQueueFactory* task_queue_factory); |
stefan@webrtc.org | 79c3359 | 2014-08-06 09:24:53 | [diff] [blame] | 30 | virtual ~FakeDecoder() {} |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 31 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 32 | int32_t InitDecode(const VideoCodec* config, |
| 33 | int32_t number_of_cores) override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 34 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 35 | int32_t Decode(const EncodedImage& input, |
| 36 | bool missing_frames, |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 37 | int64_t render_time_ms) override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 38 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 39 | int32_t RegisterDecodeCompleteCallback( |
| 40 | DecodedImageCallback* callback) override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 41 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 42 | int32_t Release() override; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 43 | |
Peter Boström | b7d9a97 | 2015-12-18 15:01:11 | [diff] [blame] | 44 | const char* ImplementationName() const override; |
| 45 | |
| 46 | static const char* kImplementationName; |
| 47 | |
Ilya Nikolaevskiy | 2ebf523 | 2019-05-13 14:13:36 | [diff] [blame] | 48 | void SetDelayedDecoding(int decode_delay_ms); |
| 49 | |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 50 | private: |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 51 | DecodedImageCallback* callback_; |
philipel | 0e07572 | 2018-04-05 11:04:42 | [diff] [blame] | 52 | int width_; |
| 53 | int height_; |
Ilya Nikolaevskiy | 2ebf523 | 2019-05-13 14:13:36 | [diff] [blame] | 54 | std::unique_ptr<rtc::TaskQueue> task_queue_; |
| 55 | TaskQueueFactory* task_queue_factory_; |
| 56 | int decode_delay_ms_; |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 57 | }; |
stefan@webrtc.org | 79c3359 | 2014-08-06 09:24:53 | [diff] [blame] | 58 | |
| 59 | class FakeH264Decoder : public FakeDecoder { |
| 60 | public: |
| 61 | virtual ~FakeH264Decoder() {} |
| 62 | |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 63 | int32_t Decode(const EncodedImage& input, |
| 64 | bool missing_frames, |
stefan@webrtc.org | 48ac226 | 2015-03-02 16:18:56 | [diff] [blame] | 65 | int64_t render_time_ms) override; |
| 66 | }; |
| 67 | |
pbos@webrtc.org | 0181b5f | 2013-09-09 08:26:30 | [diff] [blame] | 68 | } // namespace test |
| 69 | } // namespace webrtc |
| 70 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 71 | #endif // TEST_FAKE_DECODER_H_ |