fake_vp8_encoder.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2018 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_VP8_ENCODER_H_
  11. #define TEST_FAKE_VP8_ENCODER_H_
  12. #include <stddef.h>
  13. #include <stdint.h>
  14. #include <memory>
  15. #include "api/fec_controller_override.h"
  16. #include "api/video/encoded_image.h"
  17. #include "api/video_codecs/video_codec.h"
  18. #include "api/video_codecs/video_encoder.h"
  19. #include "api/video_codecs/vp8_frame_buffer_controller.h"
  20. #include "api/video_codecs/vp8_temporal_layers.h"
  21. #include "modules/video_coding/include/video_codec_interface.h"
  22. #include "rtc_base/synchronization/sequence_checker.h"
  23. #include "rtc_base/thread_annotations.h"
  24. #include "system_wrappers/include/clock.h"
  25. #include "test/fake_encoder.h"
  26. namespace webrtc {
  27. namespace test {
  28. class FakeVp8Encoder : public FakeEncoder {
  29. public:
  30. explicit FakeVp8Encoder(Clock* clock);
  31. virtual ~FakeVp8Encoder() = default;
  32. int32_t InitEncode(const VideoCodec* config,
  33. const Settings& settings) override;
  34. int32_t Release() override;
  35. EncoderInfo GetEncoderInfo() const override;
  36. private:
  37. CodecSpecificInfo PopulateCodecSpecific(size_t size_bytes,
  38. VideoFrameType frame_type,
  39. int stream_idx,
  40. uint32_t timestamp);
  41. CodecSpecificInfo EncodeHook(
  42. EncodedImage& encoded_image,
  43. rtc::scoped_refptr<EncodedImageBuffer> buffer) override;
  44. SequenceChecker sequence_checker_;
  45. class FakeFecControllerOverride : public FecControllerOverride {
  46. public:
  47. ~FakeFecControllerOverride() override = default;
  48. void SetFecAllowed(bool fec_allowed) override {}
  49. };
  50. FakeFecControllerOverride fec_controller_override_
  51. RTC_GUARDED_BY(sequence_checker_);
  52. std::unique_ptr<Vp8FrameBufferController> frame_buffer_controller_
  53. RTC_GUARDED_BY(sequence_checker_);
  54. };
  55. } // namespace test
  56. } // namespace webrtc
  57. #endif // TEST_FAKE_VP8_ENCODER_H_