fake_decoder.h 2.0 KB

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