blob: 055c55beca3b6424deea3c571e3562c4302b5ff5 [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"
18#include "api/video_codecs/video_codec.h"
19#include "api/video_codecs/video_decoder.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3120#include "modules/video_coding/include/video_codec_interface.h"
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3621#include "rtc_base/task_queue.h"
pbos@webrtc.org0181b5f2013-09-09 08:26:3022
23namespace webrtc {
24namespace test {
25
26class FakeDecoder : public VideoDecoder {
27 public:
28 FakeDecoder();
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3629 explicit FakeDecoder(TaskQueueFactory* task_queue_factory);
stefan@webrtc.org79c33592014-08-06 09:24:5330 virtual ~FakeDecoder() {}
pbos@webrtc.org0181b5f2013-09-09 08:26:3031
stefan@webrtc.org48ac2262015-03-02 16:18:5632 int32_t InitDecode(const VideoCodec* config,
33 int32_t number_of_cores) 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
Peter Boströmb7d9a972015-12-18 15:01:1144 const char* ImplementationName() const override;
45
46 static const char* kImplementationName;
47
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3648 void SetDelayedDecoding(int decode_delay_ms);
49
pbos@webrtc.org0181b5f2013-09-09 08:26:3050 private:
pbos@webrtc.org0181b5f2013-09-09 08:26:3051 DecodedImageCallback* callback_;
philipel0e075722018-04-05 11:04:4252 int width_;
53 int height_;
Ilya Nikolaevskiy2ebf5232019-05-13 14:13:3654 std::unique_ptr<rtc::TaskQueue> task_queue_;
55 TaskQueueFactory* task_queue_factory_;
56 int decode_delay_ms_;
pbos@webrtc.org0181b5f2013-09-09 08:26:3057};
stefan@webrtc.org79c33592014-08-06 09:24:5358
59class FakeH264Decoder : public FakeDecoder {
60 public:
61 virtual ~FakeH264Decoder() {}
62
stefan@webrtc.org48ac2262015-03-02 16:18:5663 int32_t Decode(const EncodedImage& input,
64 bool missing_frames,
stefan@webrtc.org48ac2262015-03-02 16:18:5665 int64_t render_time_ms) override;
66};
67
pbos@webrtc.org0181b5f2013-09-09 08:26:3068} // namespace test
69} // namespace webrtc
70
Mirko Bonadei92ea95e2017-09-15 04:47:3171#endif // TEST_FAKE_DECODER_H_