blob: 33454704e14d1be5de3e5bbe5023c01089ad4e58 [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
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3616#include "api/task_queue/task_queue_factory.h"
Yves Gerey3e707812018-11-28 15:47:4917#include "api/video/encoded_image.h"
Yves Gerey3e707812018-11-28 15:47:4918#include "api/video_codecs/video_decoder.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3119#include "modules/video_coding/include/video_codec_interface.h"
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3620#include "rtc_base/task_queue.h"
pbos@webrtc.org0181b5f2013-09-09 08:26:3021
22namespace webrtc {
23namespace test {
24
25class FakeDecoder : public VideoDecoder {
26 public:
Markus Handell588f9b32021-04-08 17:19:5027 enum { kDefaultWidth = 320, kDefaultHeight = 180 };
28
pbos@webrtc.org0181b5f2013-09-09 08:26:3029 FakeDecoder();
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3630 explicit FakeDecoder(TaskQueueFactory* task_queue_factory);
stefan@webrtc.org79c33592014-08-06 09:24:5331 virtual ~FakeDecoder() {}
pbos@webrtc.org0181b5f2013-09-09 08:26:3032
Danil Chapovalovd08930d2021-08-12 11:26:5533 bool Configure(const Settings& settings) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3034
stefan@webrtc.org48ac2262015-03-02 16:18:5635 int32_t Decode(const EncodedImage& input,
36 bool missing_frames,
stefan@webrtc.org48ac2262015-03-02 16:18:5637 int64_t render_time_ms) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3038
stefan@webrtc.org48ac2262015-03-02 16:18:5639 int32_t RegisterDecodeCompleteCallback(
40 DecodedImageCallback* callback) override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3041
stefan@webrtc.org48ac2262015-03-02 16:18:5642 int32_t Release() override;
pbos@webrtc.org0181b5f2013-09-09 08:26:3043
Erik Språngc12f6252021-01-13 20:49:5944 DecoderInfo GetDecoderInfo() const override;
Peter Boströmb7d9a972015-12-18 15:01:1145 const char* ImplementationName() const override;
46
47 static const char* kImplementationName;
48
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3649 void SetDelayedDecoding(int decode_delay_ms);
50
pbos@webrtc.org0181b5f2013-09-09 08:26:3051 private:
pbos@webrtc.org0181b5f2013-09-09 08:26:3052 DecodedImageCallback* callback_;
philipel0e075722018-04-05 11:04:4253 int width_;
54 int height_;
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3655 std::unique_ptr<rtc::TaskQueue> task_queue_;
56 TaskQueueFactory* task_queue_factory_;
57 int decode_delay_ms_;
pbos@webrtc.org0181b5f2013-09-09 08:26:3058};
stefan@webrtc.org79c33592014-08-06 09:24:5359
60class FakeH264Decoder : public FakeDecoder {
61 public:
62 virtual ~FakeH264Decoder() {}
63
stefan@webrtc.org48ac2262015-03-02 16:18:5664 int32_t Decode(const EncodedImage& input,
65 bool missing_frames,
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_