fake_vp8_encoder.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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/include/module_common_types.h"
  22. #include "modules/video_coding/include/video_codec_interface.h"
  23. #include "rtc_base/synchronization/sequence_checker.h"
  24. #include "rtc_base/thread_annotations.h"
  25. #include "system_wrappers/include/clock.h"
  26. #include "test/fake_encoder.h"
  27. namespace webrtc {
  28. namespace test {
  29. class FakeVp8Encoder : public FakeEncoder {
  30. public:
  31. explicit FakeVp8Encoder(Clock* clock);
  32. virtual ~FakeVp8Encoder() = default;
  33. int32_t InitEncode(const VideoCodec* config,
  34. const Settings& settings) override;
  35. int32_t Release() override;
  36. EncoderInfo GetEncoderInfo() const override;
  37. private:
  38. void PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
  39. size_t size_bytes,
  40. VideoFrameType frame_type,
  41. int stream_idx,
  42. uint32_t timestamp);
  43. std::unique_ptr<RTPFragmentationHeader> EncodeHook(
  44. EncodedImage* encoded_image,
  45. CodecSpecificInfo* codec_specific) override;
  46. SequenceChecker sequence_checker_;
  47. class FakeFecControllerOverride : public FecControllerOverride {
  48. public:
  49. ~FakeFecControllerOverride() override = default;
  50. void SetFecAllowed(bool fec_allowed) override {}
  51. };
  52. FakeFecControllerOverride fec_controller_override_
  53. RTC_GUARDED_BY(sequence_checker_);
  54. std::unique_ptr<Vp8FrameBufferController> frame_buffer_controller_
  55. RTC_GUARDED_BY(sequence_checker_);
  56. };
  57. } // namespace test
  58. } // namespace webrtc
  59. #endif // TEST_FAKE_VP8_ENCODER_H_