blob: e14eae0228185e7efebaffcb8feed85c0189a358 [file] [log] [blame]
pbos@webrtc.org0181b5f2013-09-09 08:26:301/*
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 Bonadei92ea95e2017-09-15 04:47:3111#ifndef TEST_FAKE_DECODER_H_
12#define TEST_FAKE_DECODER_H_
pbos@webrtc.org0181b5f2013-09-09 08:26:3013
Yves Gerey3e707812018-11-28 15:47:4914#include <stdint.h>
pbos@webrtc.org0181b5f2013-09-09 08:26:3015
Danil Chapovalov9c125c62022-07-07 18:29:3016#include <memory>
17
18#include "api/task_queue/task_queue_base.h"
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3619#include "api/task_queue/task_queue_factory.h"
Yves Gerey3e707812018-11-28 15:47:4920#include "api/video/encoded_image.h"
Yves Gerey3e707812018-11-28 15:47:4921#include "api/video_codecs/video_decoder.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3122#include "modules/video_coding/include/video_codec_interface.h"
pbos@webrtc.org0181b5f2013-09-09 08:26:3023
24namespace webrtc {
25namespace test {
26
27class FakeDecoder : public VideoDecoder {
28 public:
Markus Handell588f9b32021-04-08 17:19:5029 enum { kDefaultWidth = 320, kDefaultHeight = 180 };
30
pbos@webrtc.org0181b5f2013-09-09 08:26:3031 FakeDecoder();
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3632 explicit FakeDecoder(TaskQueueFactory* task_queue_factory);
stefan@webrtc.org79c33592014-08-06 09:24:5333 virtual ~FakeDecoder() {}
pbos@webrtc.org0181b5f2013-09-09 08:26:3034
Danil Chapovalovd08930d2021-08-12 11:26:5535 bool Configure(const Settings& settings) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3036
stefan@webrtc.org48ac2262015-03-02 16:18:5637 int32_t Decode(const EncodedImage& input,
stefan@webrtc.org48ac2262015-03-02 16:18:5638 int64_t render_time_ms) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3039
stefan@webrtc.org48ac2262015-03-02 16:18:5640 int32_t RegisterDecodeCompleteCallback(
41 DecodedImageCallback* callback) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3042
stefan@webrtc.org48ac2262015-03-02 16:18:5643 int32_t Release() override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3044
Erik Språngc12f6252021-01-13 20:49:5945 DecoderInfo GetDecoderInfo() const override;
Peter Boströmb7d9a972015-12-18 15:01:1146 const char* ImplementationName() const override;
47
48 static const char* kImplementationName;
49
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3650 void SetDelayedDecoding(int decode_delay_ms);
51
pbos@webrtc.org0181b5f2013-09-09 08:26:3052 private:
pbos@webrtc.org0181b5f2013-09-09 08:26:3053 DecodedImageCallback* callback_;
philipel0e075722018-04-05 11:04:4254 int width_;
55 int height_;
Danil Chapovalov9c125c62022-07-07 18:29:3056 std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_;
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3657 TaskQueueFactory* task_queue_factory_;
58 int decode_delay_ms_;
pbos@webrtc.org0181b5f2013-09-09 08:26:3059};
stefan@webrtc.org79c33592014-08-06 09:24:5360
61class FakeH264Decoder : public FakeDecoder {
62 public:
63 virtual ~FakeH264Decoder() {}
64
stefan@webrtc.org48ac2262015-03-02 16:18:5665 int32_t Decode(const EncodedImage& input,
stefan@webrtc.org48ac2262015-03-02 16:18:5666 int64_t render_time_ms) override;
67};
68
pbos@webrtc.org0181b5f2013-09-09 08:26:3069} // namespace test
70} // namespace webrtc
71
Mirko Bonadei92ea95e2017-09-15 04:47:3172#endif // TEST_FAKE_DECODER_H_