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 11 #ifndef TEST_FAKE_DECODER_H_ 12 #define TEST_FAKE_DECODER_H_ 13 14 #include <stdint.h> 15 16 #include "api/task_queue/task_queue_factory.h" 17 #include "api/video/encoded_image.h" 18 #include "api/video_codecs/video_codec.h" 19 #include "api/video_codecs/video_decoder.h" 20 #include "modules/video_coding/include/video_codec_interface.h" 21 #include "rtc_base/task_queue.h" 22 23 namespace webrtc { 24 namespace test { 25 26 class FakeDecoder : public VideoDecoder { 27 public: 28 FakeDecoder(); 29 explicit FakeDecoder(TaskQueueFactory* task_queue_factory); ~FakeDecoder()30 virtual ~FakeDecoder() {} 31 32 int32_t InitDecode(const VideoCodec* config, 33 int32_t number_of_cores) override; 34 35 int32_t Decode(const EncodedImage& input, 36 bool missing_frames, 37 int64_t render_time_ms) override; 38 39 int32_t RegisterDecodeCompleteCallback( 40 DecodedImageCallback* callback) override; 41 42 int32_t Release() override; 43 44 const char* ImplementationName() const override; 45 46 static const char* kImplementationName; 47 48 void SetDelayedDecoding(int decode_delay_ms); 49 50 private: 51 DecodedImageCallback* callback_; 52 int width_; 53 int height_; 54 std::unique_ptr<rtc::TaskQueue> task_queue_; 55 TaskQueueFactory* task_queue_factory_; 56 int decode_delay_ms_; 57 }; 58 59 class FakeH264Decoder : public FakeDecoder { 60 public: ~FakeH264Decoder()61 virtual ~FakeH264Decoder() {} 62 63 int32_t Decode(const EncodedImage& input, 64 bool missing_frames, 65 int64_t render_time_ms) override; 66 }; 67 68 } // namespace test 69 } // namespace webrtc 70 71 #endif // TEST_FAKE_DECODER_H_ 72